diff mbox series

[v4] tracing: Replace deprecated strncpy() with strscpy() for stack_trace_filter_buf

Message ID 20250404185816.2990559-1-devaanshk840@gmail.com (mailing list archive)
State New
Headers show
Series [v4] tracing: Replace deprecated strncpy() with strscpy() for stack_trace_filter_buf | expand

Commit Message

Devaansh Kumar April 4, 2025, 6:58 p.m. UTC
strncpy() is deprecated for NUL-terminated destination buffers and must
be replaced by strscpy().

See issue: https://github.com/KSPP/linux/issues/90

Signed-off-by: Devaansh Kumar <devaanshk840@gmail.com>
---
 kernel/trace/trace_stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 5a48dba912ea..617e59a234da 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -544,7 +544,7 @@  static __init int enable_stacktrace(char *str)
 	int len;
 
 	if ((len = str_has_prefix(str, "_filter=")))
-		strncpy(stack_trace_filter_buf, str + len, COMMAND_LINE_SIZE);
+		strscpy(stack_trace_filter_buf, str + len, sizeof(stack_trace_filter_buf));
 
 	stack_tracer_enabled = 1;
 	return 1;