]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
staging: sep: using strlcpy instead of strncpy
authorChen Gang <gang.chen@asianux.com>
Sun, 17 Feb 2013 03:53:15 +0000 (11:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 11 Mar 2013 16:15:32 +0000 (09:15 -0700)
  set '\0' at tail for NUL terminated string, or TP_printk may cause issue.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/sep/sep_trace_events.h

index 2b053a93afe69665a46e06098d5eb9619df30534..74f4c9a2b5be361bebff0342a70c714fa880a334 100644 (file)
  */
 #include <linux/tracepoint.h>
 
+/*
+ * Since use str*cpy in header file, better to include string.h, directly.
+ */
+#include <linux/string.h>
+
 /*
  * The TRACE_EVENT macro is broken up into 5 parts.
  *
@@ -97,7 +102,7 @@ TRACE_EVENT(sep_func_start,
        ),
 
        TP_fast_assign(
-               strncpy(__entry->name, name, 20);
+               strlcpy(__entry->name, name, 20);
                __entry->branch = branch;
        ),
 
@@ -116,7 +121,7 @@ TRACE_EVENT(sep_func_end,
        ),
 
        TP_fast_assign(
-               strncpy(__entry->name, name, 20);
+               strlcpy(__entry->name, name, 20);
                __entry->branch = branch;
        ),
 
@@ -135,7 +140,7 @@ TRACE_EVENT(sep_misc_event,
        ),
 
        TP_fast_assign(
-               strncpy(__entry->name, name, 20);
+               strlcpy(__entry->name, name, 20);
                __entry->branch = branch;
        ),