Commit d8bde3bf authored by Xiaobo Liu's avatar Xiaobo Liu Committed by David S. Miller

net/atm: fix proc_mpc_write incorrect return value

Then the input contains '\0' or '\n', proc_mpc_write has read them,
so the return value needs +1.

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarXiaobo Liu <cppcoffee@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a8aed7b3
...@@ -219,11 +219,12 @@ static ssize_t proc_mpc_write(struct file *file, const char __user *buff, ...@@ -219,11 +219,12 @@ static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
if (!page) if (!page)
return -ENOMEM; return -ENOMEM;
for (p = page, len = 0; len < nbytes; p++, len++) { for (p = page, len = 0; len < nbytes; p++) {
if (get_user(*p, buff++)) { if (get_user(*p, buff++)) {
free_page((unsigned long)page); free_page((unsigned long)page);
return -EFAULT; return -EFAULT;
} }
len += 1;
if (*p == '\0' || *p == '\n') if (*p == '\0' || *p == '\n')
break; break;
} }
......
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