The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] kernel: trace: strncpy, using strlcpy instead of strncpy
@ 2013-04-08  4:06 Chen Gang
  2013-04-08 15:30 ` [tip:perf/urgent] perf: Fix strncpy() use, use strlcpy() instead of strncpy() tip-bot for Chen Gang
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Gang @ 2013-04-08  4:06 UTC (permalink / raw)
  To: rostedt, Frederic Weisbecker, mingo@redhat.com,
	linux-kernel@vger.kernel.org


  for NUL terminated string, need always set '\0' at the end.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 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 829b2be..07860b9 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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;
 }
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-08 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08  4:06 [PATCH] kernel: trace: strncpy, using strlcpy instead of strncpy Chen Gang
2013-04-08 15:30 ` [tip:perf/urgent] perf: Fix strncpy() use, use strlcpy() instead of strncpy() tip-bot for Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox