tracing: Replace deprecated strncpy() with strscpy() for stack_trace_filter_buf
PATCH RESEND v5 1/1 tracing: Replace deprecated strncpy() with strscpy() for stack_trace_filter_buf
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 <[email protected]>
---
Changes since v4:
- Removed unnecessary sizeof(stack_trace_filter_buf) in strscpy
Changes since v3:
- Refactored code to compare length with str_has_prefix in a single line
Changes since v2;
- Removed unnecessary string.h header file inclusion
Changes since v1:
- Moved from memcpy() to strscpy()
kernel/trace/trace_stack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_stack.c +1 -1
@@ -542,7 +542,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); stack_tracer_enabled =1 ;return 1 ;
Signature · 1 line
2.49.0