ftrace: Fix strncpy() use, use strlcpy() instead of strncpy()
authorChen Gang <gang.chen@asianux.com>
Mon, 8 Apr 2013 04:12:39 +0000 (12:12 +0800)
committerIngo Molnar <mingo@kernel.org>
Mon, 8 Apr 2013 11:26:56 +0000 (13:26 +0200)
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/516243B7.9020405@asianux.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/trace/ftrace.c

index 6893d5a2bf086014f2919496ca7062c246935dad..db143742704b4c36b60f7c296d7f79dc1d1ed057 100644 (file)
@@ -3441,14 +3441,14 @@ static char ftrace_filter_buf[FTRACE_FILTER_SIZE] __initdata;
 
 static int __init set_ftrace_notrace(char *str)
 {
-       strncpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
+       strlcpy(ftrace_notrace_buf, str, FTRACE_FILTER_SIZE);
        return 1;
 }
 __setup("ftrace_notrace=", set_ftrace_notrace);
 
 static int __init set_ftrace_filter(char *str)
 {
-       strncpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
+       strlcpy(ftrace_filter_buf, str, FTRACE_FILTER_SIZE);
        return 1;
 }
 __setup("ftrace_filter=", set_ftrace_filter);