From: Frederik Deweerdt Date: Fri, 29 Sep 2006 09:01:02 +0000 (-0700) Subject: [PATCH] fix mem_write() return value X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f7ca54f486d3b07f48b8bbc92705bde6ba98ee54;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] fix mem_write() return value 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 Acked-by: Eric Biederman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/base.c b/fs/proc/base.c index fe8d55fb17cc..89c20d9d50bf 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -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;