]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tracing: Replace strncpy with memcpy for fixed-length substring copy
authorSiddarth G <siddarthsgml@gmail.com>
Tue, 25 Mar 2025 18:12:32 +0000 (23:42 +0530)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 25 Mar 2025 21:44:32 +0000 (17:44 -0400)
commite0344f9564f5847dc20e245fbea67a4b262ee659
tree5159474873510e17947b157e0a485c03f2ecd1b9
parent4d38328eb442dc06aec4350fd9594ffa6488af02
tracing: Replace strncpy with memcpy for fixed-length substring copy

checkpatch.pl reports the following warning:
WARNING: Prefer strscpy, strscpy_pad, or __nonstring over strncpy
(see: https://github.com/KSPP/linux/issues/90)

In synth_field_string_size(), replace strncpy() with memcpy() to copy 'len'
characters from 'start' to 'buf'. The code manually adds a NUL terminator
after the copy, making memcpy safe here.

Link: https://lore.kernel.org/20250325181232.38284-1-siddarthsgml@gmail.com
Signed-off-by: Siddarth G <siddarthsgml@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_events_synth.c