]> err.no Git - linux-2.6/commitdiff
[PATCH] fix mem_write() return value
authorFrederik Deweerdt <deweerdt@free.fr>
Fri, 29 Sep 2006 09:01:02 +0000 (02:01 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 29 Sep 2006 16:18:19 +0000 (09:18 -0700)
At the beginning of the routine, "copied" is set to 0, but it is no good
because in lines 805 and 812 it is set to other values.  Finally, the
routine returns as if it copied 12 (=ENOMEM) bytes less than it actually
did.

Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com>
Acked-by: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/proc/base.c

index fe8d55fb17cc37da251cfd524dfc14dfb1711c72..89c20d9d50bfbf09c77aca8ca921885bb7eb0084 100644 (file)
@@ -797,7 +797,7 @@ out_no_task:
 static ssize_t mem_write(struct file * file, const char * buf,
                         size_t count, loff_t *ppos)
 {
-       int copied = 0;
+       int copied;
        char *page;
        struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
        unsigned long dst = *ppos;
@@ -814,6 +814,7 @@ static ssize_t mem_write(struct file * file, const char * buf,
        if (!page)
                goto out;
 
+       copied = 0;
        while (count > 0) {
                int this_len, retval;