Commit 67012ab1 authored by Chen Gang's avatar Chen Gang Committed by Ingo Molnar

perf: Fix strncpy() use, use strlcpy() instead of strncpy()

For NUL terminated string we always need to set '\0' at the end.
Signed-off-by: default avatarChen Gang <gang.chen@asianux.com>
Cc: rostedt@goodmis.org
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/51624254.30301@asianux.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent c97847d2
...@@ -132,7 +132,7 @@ static char *default_bootup_tracer; ...@@ -132,7 +132,7 @@ static char *default_bootup_tracer;
static int __init set_cmdline_ftrace(char *str) static int __init set_cmdline_ftrace(char *str)
{ {
strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
default_bootup_tracer = bootup_tracer_buf; default_bootup_tracer = bootup_tracer_buf;
/* We are using ftrace early, expand it */ /* We are using ftrace early, expand it */
ring_buffer_expanded = 1; ring_buffer_expanded = 1;
...@@ -162,7 +162,7 @@ static char *trace_boot_options __initdata; ...@@ -162,7 +162,7 @@ static char *trace_boot_options __initdata;
static int __init set_trace_boot_options(char *str) static int __init set_trace_boot_options(char *str)
{ {
strncpy(trace_boot_options_buf, str, MAX_TRACER_SIZE); strlcpy(trace_boot_options_buf, str, MAX_TRACER_SIZE);
trace_boot_options = trace_boot_options_buf; trace_boot_options = trace_boot_options_buf;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment