From: bookjovi@gmail.com
To: bookjovi@gmail.com
Cc: Andrew Morton <akpm@linux-foundation.org>
(commit_signer:17/41=41%),
Al Viro <viro@zeniv.linux.org.uk> (commit_signer:7/41=17%),
David Rientjes <rientjes@google.com> (commit_signer:7/41=17%),
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
(commit_signer:4/41=10%),
Nick Piggin <npiggin@kernel.dk> (commit_signer:4/41=10%),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 2/2] proc: fix some wrong error code usage
Date: Wed, 2 Mar 2011 17:20:22 -0500 [thread overview]
Message-ID: <1299104422-2620-1-git-send-email-bookjovi@gmail.com> (raw)
From: Jovi Zhang <bookjovi@gmail.com>
[root@wei 1]# cat /proc/1/mem
cat: /proc/1/mem: No such process
error code -ESRCH is wrong in this situation
Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
---
fs/proc/base.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 9d096e8..9c23db0 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -775,7 +775,8 @@ static ssize_t mem_read(struct file * file, char __user * buf,
if (!task)
goto out_no_task;
- if (check_mem_permission(task))
+ ret = check_mem_permission(task);
+ if (ret)
goto out;
ret = -ENOMEM;
@@ -845,7 +846,8 @@ static ssize_t mem_write(struct file * file, const char __user *buf,
if (!task)
goto out_no_task;
- if (check_mem_permission(task))
+ copied = check_mem_permission(task);
+ if (copied)
goto out;
copied = -ENOMEM;
@@ -917,6 +919,7 @@ static ssize_t environ_read(struct file *file, char __user *buf,
if (!task)
goto out_no_task;
+ ret = -EPERM;
if (!ptrace_may_access(task, PTRACE_MODE_READ))
goto out;
--
1.7.2.3
next reply other threads:[~2011-03-05 8:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-02 22:20 bookjovi [this message]
2011-03-06 11:39 ` [PATCH 2/2] proc: fix some wrong error code usage KOSAKI Motohiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1299104422-2620-1-git-send-email-bookjovi@gmail.com \
--to=bookjovi@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@kernel.dk \
--cc=rientjes@google.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).