Commit f7ca54f4 authored by Frederik Deweerdt's avatar Frederik Deweerdt Committed by Linus Torvalds
Browse files

[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: default avatarFrederik Deweerdt <frederik.deweerdt@gmail.com>
Acked-by: default avatarEric Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 87d7c8ac
...@@ -797,7 +797,7 @@ static ssize_t mem_read(struct file * file, char __user * buf, ...@@ -797,7 +797,7 @@ static ssize_t mem_read(struct file * file, char __user * buf,
static ssize_t mem_write(struct file * file, const char * buf, static ssize_t mem_write(struct file * file, const char * buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
int copied = 0; int copied;
char *page; char *page;
struct task_struct *task = get_proc_task(file->f_dentry->d_inode); struct task_struct *task = get_proc_task(file->f_dentry->d_inode);
unsigned long dst = *ppos; unsigned long dst = *ppos;
...@@ -814,6 +814,7 @@ static ssize_t mem_write(struct file * file, const char * buf, ...@@ -814,6 +814,7 @@ static ssize_t mem_write(struct file * file, const char * buf,
if (!page) if (!page)
goto out; goto out;
copied = 0;
while (count > 0) { while (count > 0) {
int this_len, retval; int this_len, retval;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment