提交 f7ca54f4 编写于 作者: F Frederik Deweerdt 提交者: Linus Torvalds

[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: NFrederik Deweerdt <frederik.deweerdt@gmail.com>
Acked-by: NEric Biederman <ebiederm@xmission.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 87d7c8ac
......@@ -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,
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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册