Skip to contentSkip to conversation

net/atm: fix proc_mpc_write incorrect return value

PATCH Applied Xiaobo Liu 2 participants 2 messages Oct 14, 2022 – Oct 15, 2022

Subsystems (3)
lore
Share & tools
lore

Xiaobo Liu

author
#0 lore raw

PATCH 1/1 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")
---
 net/atm/mpoa_proc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/atm/mpoa_proc.c +2 -1
index 829db9eba..aaf64b953 100755
@@ -219,11 +219,12 @@ static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
 	if (!page)
 		return -ENOMEM;
 
-	for (p = page, len = 0; len < nbytes; p++, len++) {
+	for (p = page, len = 0; len < nbytes; p++) {
 		if (get_user(*p, buff++)) {
 			free_page((unsigned long)page);
 			return -EFAULT;
 		}
+		len += 1;
 		if (*p == '\0' || *p == '\n')
 			break;
 	}
Signature · 1 line
2.21.0 (Apple Git-122.2)
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 8 lines · On Fri, 14 Oct 2022 10:05:40 +0800 you wrote:

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")

[...]

Here is the summary with links:
- net/atm: fix proc_mpc_write incorrect return value

    https://git.kernel.org/netdev/net/c/d8bde3bf7f82

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html