mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-14 12:37:32 +00:00
net/atm: fix proc_mpc_write incorrect return value
[ Upstream commitd8bde3bf7f
] Then the input contains '\0' or '\n', proc_mpc_write has read them, so the return value needs +1. Fixes:1da177e4c3
("Linux-2.6.12-rc2") Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c8310a99e7
commit
118f412bed
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue