summaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_stack.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-12-22 05:10:26 +0100
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-12-23 04:52:30 +0100
commit3d739c1f6156c70eb0548aa288dcfbac9e0bd162 (patch)
tree4f2ae9eccd5478a2689171c8ce2c6466d4b9c247 /kernel/trace/trace_stack.c
parenttracing: Have the historgram use the result of str_has_prefix() for len of pr... (diff)
downloadlinux-3d739c1f6156c70eb0548aa288dcfbac9e0bd162.tar.xz
linux-3d739c1f6156c70eb0548aa288dcfbac9e0bd162.zip
tracing: Use the return of str_has_prefix() to remove open coded numbers
There are several locations that compare constants to the beginning of string variables to determine what commands should be done, then the constant length is used to index into the string. This is error prone as the hard coded numbers have to match the size of the constants. Instead, use the len returned from str_has_prefix() and remove the open coded string length sizes. Cc: Joe Perches <joe@perches.com> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> (for trace_probe part) 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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index 3641f28c343f..eec648a0d673 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -448,8 +448,10 @@ static char stack_trace_filter_buf[COMMAND_LINE_SIZE+1] __initdata;
static __init int enable_stacktrace(char *str)
{
- if (str_has_prefix(str, "_filter="))
- strncpy(stack_trace_filter_buf, str+8, COMMAND_LINE_SIZE);
+ int len;
+
+ if ((len = str_has_prefix(str, "_filter=")))
+ strncpy(stack_trace_filter_buf, str + len, COMMAND_LINE_SIZE);
stack_tracer_enabled = 1;
last_stack_tracer_enabled = 1;