aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2010-01-13 21:53:41 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-01-14 22:38:07 -0500
commita3291c14ecf0a995e30d993b7f2cae031de98727 (patch)
tree46b0ed65d437fdffba57866af1ce51d0d15a7673
parent285caad415f459f336247932b4db95a571357a02 (diff)
tracing/filters: Fix MATCH_END_ONLY filter matching
For '*foo' pattern, we should allow any string ending with 'foo', but event filtering incorrectly disallows strings like bar_foo_foo: Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <4B4E8735.6070604@cn.fujitsu.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel/trace/trace_events_filter.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 11c3973e655..49e44dd1785 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -275,9 +275,10 @@ static int regex_match_middle(char *str, struct regex *r, int len)
275 275
276static int regex_match_end(char *str, struct regex *r, int len) 276static int regex_match_end(char *str, struct regex *r, int len)
277{ 277{
278 char *ptr = strstr(str, r->pattern); 278 int strlen = len - 1;
279 279
280 if (ptr && (ptr[r->len] == 0)) 280 if (strlen >= r->len &&
281 memcmp(str + strlen - r->len, r->pattern, r->len) == 0)
281 return 1; 282 return 1;
282 return 0; 283 return 0;
283} 284}