diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-12-20 13:20:07 -0500 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-12-22 22:51:54 -0500 |
commit | b6b2735514bcd70ad1556a33892a636b20ece671 (patch) | |
tree | a51e1477fef62ca3223c272306ab4162ae23cb05 /kernel/trace/trace_stack.c | |
parent | 754481e6954cbef53f8bc4412ad48dde611e21d3 (diff) | |
download | linux-b6b2735514bcd70ad1556a33892a636b20ece671.tar.bz2 |
tracing: Use str_has_prefix() instead of using fixed sizes
There are several instances of strncmp(str, "const", 123), where 123 is the
strlen of the const string to check if "const" is the prefix of str. But
this can be error prone. Use str_has_prefix() instead.
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_stack.c')
-rw-r--r-- | kernel/trace/trace_stack.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index e2a153fc1afc..3641f28c343f 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c @@ -448,7 +448,7 @@ static char stack_trace_filter_buf[COMMAND_LINE_SIZE+1] __initdata; static __init int enable_stacktrace(char *str) { - if (strncmp(str, "_filter=", 8) == 0) + if (str_has_prefix(str, "_filter=")) strncpy(stack_trace_filter_buf, str+8, COMMAND_LINE_SIZE); stack_tracer_enabled = 1; |