Commit d1303dd1d6b220cab375f24fa91a5640e54e169e

Authored by Li Zefan
Committed by Steven Rostedt
1 parent 16da27a8bc

tracing/filters: Add comment for match callbacks

We should be clear on 2 things:

- the length parameter of a match callback includes
  tailing '\0'.

- the string to be searched might not be NULL-terminated.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4B4E8770.7000608@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Showing 1 changed file with 12 additions and 1 deletions Side-by-side Diff

kernel/trace/trace_events_filter.c
... ... @@ -252,7 +252,18 @@
252 252 return 0;
253 253 }
254 254  
255   -/* Basic regex callbacks */
  255 +/*
  256 + * regex_match_foo - Basic regex callbacks
  257 + *
  258 + * @str: the string to be searched
  259 + * @r: the regex structure containing the pattern string
  260 + * @len: the length of the string to be searched (including '\0')
  261 + *
  262 + * Note:
  263 + * - @str might not be NULL-terminated if it's of type DYN_STRING
  264 + * or STATIC_STRING
  265 + */
  266 +
256 267 static int regex_match_full(char *str, struct regex *r, int len)
257 268 {
258 269 if (strncmp(str, r->pattern, len) == 0)