[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221020090547.398680-1-cui.jinpeng2@zte.com.cn>
Date: Thu, 20 Oct 2022 09:05:47 +0000
From: cuijinpeng666@...il.com
To: ast@...nel.org, keescook@...omium.org, jolsa@...nel.org,
cui.jinpeng2@....com.cn
Cc: peterz@...radead.org, stephen.s.brennan@...cle.com,
alan.maguire@...cle.com, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org, Zeal Robot <zealci@....com.cn>
Subject: [PATCH linux-next] kallsyms: Use strscpy() instead of strlcpy()
From: Jinpeng Cui <cui.jinpeng2@....com.cn>
The implementation of strscpy() is more robust and safer.
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Jinpeng Cui <cui.jinpeng2@....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
Powered by blists - more mailing lists