staging: sep: using strlcpy instead of strncpy
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>
This commit is contained in:
parent
acb84e9ec2
commit
6d8a94e67f
|
@ -52,6 +52,11 @@
|
|||
*/
|
||||
#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;
|
||||
),
|
||||
|
||||
|
|
Loading…
Reference in New Issue