From: Xiaobo Liu <cppcoffee@gmail.com>
To: davem@davemloft.net
Cc: edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Xiaobo Liu <cppcoffee@gmail.com>
Subject: [PATCH] net/atm: fix proc_mpc_write 1 byte less calculated
Date: Thu, 13 Oct 2022 23:19:01 +0800 [thread overview]
Message-ID: <20221013151901.29368-1-cppcoffee@gmail.com> (raw)
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)
next reply other threads:[~2022-10-13 15:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 15:19 Xiaobo Liu [this message]
2022-10-13 15:37 ` [PATCH] net/atm: fix proc_mpc_write 1 byte less calculated Eric Dumazet
2022-10-13 20:13 ` kernel test robot
2022-10-13 20:23 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221013151901.29368-1-cppcoffee@gmail.com \
--to=cppcoffee@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).