Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chen Gang and committed by
Greg Kroah-Hartman
6d8a94e6 acb84e9e

+8 -3
+8 -3
drivers/staging/sep/sep_trace_events.h
··· 53 53 #include <linux/tracepoint.h> 54 54 55 55 /* 56 + * Since use str*cpy in header file, better to include string.h, directly. 57 + */ 58 + #include <linux/string.h> 59 + 60 + /* 56 61 * The TRACE_EVENT macro is broken up into 5 parts. 57 62 * 58 63 * name: name of the trace point. This is also how to enable the tracepoint. ··· 102 97 ), 103 98 104 99 TP_fast_assign( 105 - strncpy(__entry->name, name, 20); 100 + strlcpy(__entry->name, name, 20); 106 101 __entry->branch = branch; 107 102 ), 108 103 ··· 121 116 ), 122 117 123 118 TP_fast_assign( 124 - strncpy(__entry->name, name, 20); 119 + strlcpy(__entry->name, name, 20); 125 120 __entry->branch = branch; 126 121 ), 127 122 ··· 140 135 ), 141 136 142 137 TP_fast_assign( 143 - strncpy(__entry->name, name, 20); 138 + strlcpy(__entry->name, name, 20); 144 139 __entry->branch = branch; 145 140 ), 146 141