[PATCH linux-next] kallsyms: Use strscpy() instead of strlcpy()

cuijinpeng666@gmail.com posted 1 patch 3 years, 5 months ago
kernel/kallsyms.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH linux-next] kallsyms: Use strscpy() instead of strlcpy()
Posted by cuijinpeng666@gmail.com 3 years, 5 months ago
From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>

The implementation of strscpy() is more robust and safer.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
---
 kernel/kallsyms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index cc244c02b4cf..639de60ed417 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -660,7 +660,7 @@ static int get_ksymbol_bpf(struct kallsym_iter *iter)
 {
 	int ret;
 
-	strlcpy(iter->module_name, "bpf", MODULE_NAME_LEN);
+	strscpy(iter->module_name, "bpf", MODULE_NAME_LEN);
 	iter->exported = 0;
 	ret = bpf_get_kallsym(iter->pos - iter->pos_ftrace_mod_end,
 			      &iter->value, &iter->type,
@@ -680,7 +680,7 @@ static int get_ksymbol_bpf(struct kallsym_iter *iter)
  */
 static int get_ksymbol_kprobe(struct kallsym_iter *iter)
 {
-	strlcpy(iter->module_name, "__builtin__kprobes", MODULE_NAME_LEN);
+	strscpy(iter->module_name, "__builtin__kprobes", MODULE_NAME_LEN);
 	iter->exported = 0;
 	return kprobe_get_kallsym(iter->pos - iter->pos_bpf_end,
 				  &iter->value, &iter->type,
-- 
2.25.1
Re: [PATCH linux-next] kallsyms: Use strscpy() instead of strlcpy()
Posted by Greg KH 3 years, 5 months ago
On Thu, Oct 20, 2022 at 09:05:47AM +0000, cuijinpeng666@gmail.com wrote:
> From: Jinpeng Cui <cui.jinpeng2@zte.com.cn>
> 
> The implementation of strscpy() is more robust and safer.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Jinpeng Cui <cui.jinpeng2@zte.com.cn>

Again, please stop.

I have told you, and others who are purporting to send patches from ZTE
to please stop using gmail.com addresses as there is no way to verify
that you really are from ZTE.  You are potentially lying about who you
are here, which is not allowed in kernel development for obvious
reasons.

Also, these email addresses are "one way only" with no responses ever
being recieved, and so they have been banned from vger mailing lists.

I will go ask this one to be banned as well.

Please work with your employer to get their email settings fixed up so
that you can properly send patches.  Do NOT abuse gmail for this as
that's not ok.

greg k-h