netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/atm: fix proc_mpc_write 1 byte less calculated
@ 2022-10-13 15:19 Xiaobo Liu
  2022-10-13 15:37 ` Eric Dumazet
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Xiaobo Liu @ 2022-10-13 15:19 UTC (permalink / raw)
  To: davem; +Cc: edumazet, kuba, pabeni, netdev, linux-kernel, Xiaobo Liu

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

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
---
 net/atm/mpoa_proc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c
index 829db9eba..444ceda60 100755
--- a/net/atm/mpoa_proc.c
+++ b/net/atm/mpoa_proc.c
@@ -224,8 +224,11 @@ static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
 			free_page((unsigned long)page);
 			return -EFAULT;
 		}
-		if (*p == '\0' || *p == '\n')
+
+		if (*p == '\0' || *p == '\n') {
+			len += 1
 			break;
+		}
 	}
 
 	*p = '\0';
-- 
2.21.0 (Apple Git-122.2)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-13 20:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-13 15:19 [PATCH] net/atm: fix proc_mpc_write 1 byte less calculated Xiaobo Liu
2022-10-13 15:37 ` Eric Dumazet
2022-10-13 20:13 ` kernel test robot
2022-10-13 20:23 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).