Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Xiaobo Liu and committed by
David S. Miller
d8bde3bf a8aed7b3

+2 -1
+2 -1
net/atm/mpoa_proc.c
··· 219 219 if (!page) 220 220 return -ENOMEM; 221 221 222 - for (p = page, len = 0; len < nbytes; p++, len++) { 222 + for (p = page, len = 0; len < nbytes; p++) { 223 223 if (get_user(*p, buff++)) { 224 224 free_page((unsigned long)page); 225 225 return -EFAULT; 226 226 } 227 + len += 1; 227 228 if (*p == '\0' || *p == '\n') 228 229 break; 229 230 }