kernel: trace: strncpy, using strlcpy instead of strncpy
PATCH 1/1 kernel: trace: strncpy, using strlcpy instead of strncpy
for NUL terminated string, need always set '\0' at the end.
Signed-off-by Chen Gang <[email protected]>
--- kernel/trace/trace.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -2
@@ -125,7 +125,7 @@ static bool allocate_snapshot;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;/* We are using ftrace early, expand it */ ring_buffer_expanded = true;
@@ -164,7 +164,7 @@ static char *trace_boot_options __initdata;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;return 0 ; }
Signature · 1 line
1.7.7.6
tip-bot for Chen Gang
merge bot[tip:perf/urgent] perf: Fix strncpy() use, use strlcpy() instead of strncpy()
perf: Fix strncpy() use, use strlcpy() instead of strncpy()
Commit-ID: 67012ab1d2ce871afea4ee55408f233f97d09d07 Gitweb: http://git.kernel.org/tip/67012ab1d2ce871afea4ee55408f233f97d09d07 Author: Chen Gang <[email protected]> AuthorDate: Mon, 8 Apr 2013 12:06:44 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 8 Apr 2013 13:26:56 +0200
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 <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- kernel/trace/trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -2
@@ -132,7 +132,7 @@ static char *default_bootup_tracer;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;/* We are using ftrace early, expand it */ ring_buffer_expanded =1 ;
@@ -162,7 +162,7 @@ static char *trace_boot_options __initdata;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;return 0 ; }