diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-04-08 00:06:44 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-04-09 11:25:08 -0400 |
commit | 9607a869ee59594f3f7b9f3ac43a11d92bf3f960 (patch) | |
tree | 18dcec81e889275f3003535f9f2e96cdb7f50298 /kernel/trace | |
parent | 22f45649ce08642ad7df238d5c25fa5c86bfdd31 (diff) |
kernel: tracing: Use strlcpy instead of strncpy
Use strlcpy() instead of strncpy() as it will always add a '\0'
to the end of the string even if the buffer is smaller than what
is being copied.
Link: http://lkml.kernel.org/r/51624254.30301@asianux.com
Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ftrace.c | 4 | ||||
-rw-r--r-- | kernel/trace/trace.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 25770824598f..548a1f7ea2c1 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3496,14 +3496,14 @@ static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata; | |||
3496 | 3496 | ||
3497 | static int __init set_ftrace_notrace(char *str) | 3497 | static int __init set_ftrace_notrace(char *str) |
3498 | { | 3498 | { |
3499 | strncpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE); | 3499 | strlcpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE); |
3500 | return 1; | 3500 | return 1; |
3501 | } | 3501 | } |
3502 | __setup("ftrace_notrace=", set_ftrace_notrace); | 3502 | __setup("ftrace_notrace=", set_ftrace_notrace); |
3503 | 3503 | ||
3504 | static int __init set_ftrace_filter(char *str) | 3504 | static int __init set_ftrace_filter(char *str) |
3505 | { | 3505 | { |
3506 | strncpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE); | 3506 | strlcpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE); |
3507 | return 1; | 3507 | return 1; |
3508 | } | 3508 | } |
3509 | __setup("ftrace_filter=", set_ftrace_filter); | 3509 | __setup("ftrace_filter=", set_ftrace_filter); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 829b2bee24e8..07860b995752 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -125,7 +125,7 @@ static bool allocate_snapshot; | |||
125 | 125 | ||
126 | static int __init set_cmdline_ftrace(char *str) | 126 | static int __init set_cmdline_ftrace(char *str) |
127 | { | 127 | { |
128 | strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); | 128 | strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE); |
129 | default_bootup_tracer = bootup_tracer_buf; | 129 | default_bootup_tracer = bootup_tracer_buf; |
130 | /* We are using ftrace early, expand it */ | 130 | /* We are using ftrace early, expand it */ |
131 | ring_buffer_expanded = true; | 131 | ring_buffer_expanded = true; |
@@ -164,7 +164,7 @@ static char *trace_boot_options __initdata; | |||
164 | 164 | ||
165 | static int __init set_trace_boot_options(char *str) | 165 | static int __init set_trace_boot_options(char *str) |
166 | { | 166 | { |
167 | strncpy(trace_boot_options_buf, str, MAX_TRACER_SIZE); | 167 | strlcpy(trace_boot_options_buf, str, MAX_TRACER_SIZE); |
168 | trace_boot_options = trace_boot_options_buf; | 168 | trace_boot_options = trace_boot_options_buf; |
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |