* [PATCH bpf-next] bpf: Replace deprecated strcpy() with strscpy()
@ 2025-07-14 18:23 Thorsten Blum
2025-07-14 18:45 ` Quentin Monnet
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-07-14 18:23 UTC (permalink / raw)
To: Quentin Monnet, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa
Cc: Thorsten Blum, bpf, linux-kernel
strcpy() is deprecated; use strscpy() instead.
No functional changes intended.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
kernel/bpf/disasm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/bpf/disasm.c b/kernel/bpf/disasm.c
index 20883c6b1546..c8f657237e97 100644
--- a/kernel/bpf/disasm.c
+++ b/kernel/bpf/disasm.c
@@ -349,7 +349,7 @@ void print_bpf_insn(const struct bpf_insn_cbs *cbs,
__func_get_name(cbs, insn,
tmp, sizeof(tmp)));
} else {
- strcpy(tmp, "unknown");
+ strscpy(tmp, "unknown");
verbose(cbs->private_data, "(%02x) call %s#%d\n", insn->code,
__func_get_name(cbs, insn,
tmp, sizeof(tmp)),
--
2.50.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] bpf: Replace deprecated strcpy() with strscpy()
2025-07-14 18:23 [PATCH bpf-next] bpf: Replace deprecated strcpy() with strscpy() Thorsten Blum
@ 2025-07-14 18:45 ` Quentin Monnet
0 siblings, 0 replies; 2+ messages in thread
From: Quentin Monnet @ 2025-07-14 18:45 UTC (permalink / raw)
To: Thorsten Blum, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa
Cc: bpf, linux-kernel
2025-07-14 20:23 UTC+0200 ~ Thorsten Blum <thorsten.blum@linux.dev>
> strcpy() is deprecated; use strscpy() instead.
>
> No functional changes intended.
>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> kernel/bpf/disasm.c | 2 +-
Hi and thank you for the patch,
The disassembler file is also part of bpftool's source code [0][1],
where it is compiled as user space code, and where strscpy() is not
defined. So I'd rather not replace this particular occurrence of
strcpy(). We could add a comment in the file to mention this, though.
Thanks,
Quentin
[0]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/bpf/bpftool/Makefile#n246
[1]:
https://github.com/libbpf/bpftool/blob/v7.5.0/src/kernel/bpf/disasm.c#L340
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-14 18:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 18:23 [PATCH bpf-next] bpf: Replace deprecated strcpy() with strscpy() Thorsten Blum
2025-07-14 18:45 ` Quentin Monnet
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).