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:
Chen Gang 2013-02-17 11:53:15 +08:00 committed by Greg Kroah-Hartman
parent acb84e9ec2
commit 6d8a94e67f
1 changed files with 8 additions and 3 deletions

View File

@ -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;
),