diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-04-08 00:06:44 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-04-08 07:26:56 -0400 |
commit | 67012ab1d2ce871afea4ee55408f233f97d09d07 (patch) | |
tree | 3f44d6c02233abb51848bfa991d571e86397b431 /kernel/trace/trace.c | |
parent | c97847d2f0eb77c806e650e04d9bbcf79fa05730 (diff) |
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: Chen Gang <gang.chen@asianux.com>
Cc: rostedt@goodmis.org
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/51624254.30301@asianux.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 4f1dade56981..3f5046a4d81b 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -132,7 +132,7 @@ static char *default_bootup_tracer; | |||
132 | 132 | ||
133 | static int __init set_cmdline_ftrace(char *str) | 133 | static int __init set_cmdline_ftrace(char *str) |
134 | { | 134 | { |
135 | strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); | 135 | strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); |
136 | default_bootup_tracer = bootup_tracer_buf; | 136 | default_bootup_tracer = bootup_tracer_buf; |
137 | /* We are using ftrace early, expand it */ | 137 | /* We are using ftrace early, expand it */ |
138 | ring_buffer_expanded = 1; | 138 | ring_buffer_expanded = 1; |
@@ -162,7 +162,7 @@ static char *trace_boot_options __initdata; | |||
162 | 162 | ||
163 | static int __init set_trace_boot_options(char *str) | 163 | static int __init set_trace_boot_options(char *str) |
164 | { | 164 | { |
165 | strncpy(trace_boot_options_buf, str, MAX_TRACER_SIZE); | 165 | strlcpy(trace_boot_options_buf, str, MAX_TRACER_SIZE); |
166 | trace_boot_options = trace_boot_options_buf; | 166 | trace_boot_options = trace_boot_options_buf; |
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |