linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] proc: fix some wrong error code usage
@ 2011-03-02 22:20 bookjovi
  2011-03-06 11:39 ` KOSAKI Motohiro
  0 siblings, 1 reply; 2+ messages in thread
From: bookjovi @ 2011-03-02 22:20 UTC (permalink / raw)
  To: bookjovi
  Cc: Andrew Morton, Al Viro, David Rientjes, KOSAKI Motohiro,
	Nick Piggin, open list

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] proc: fix some wrong error code usage
  2011-03-02 22:20 [PATCH 2/2] proc: fix some wrong error code usage bookjovi
@ 2011-03-06 11:39 ` KOSAKI Motohiro
  0 siblings, 0 replies; 2+ messages in thread
From: KOSAKI Motohiro @ 2011-03-06 11:39 UTC (permalink / raw)
  To: bookjovi
  Cc: kosaki.motohiro, Andrew Morton, Al Viro, David Rientjes,
	Nick Piggin, linux-kernel

> 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>

Looks fine.
	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-06 11:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 22:20 [PATCH 2/2] proc: fix some wrong error code usage bookjovi
2011-03-06 11:39 ` KOSAKI Motohiro

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).