Commit a3291c14 authored by Li Zefan's avatar Li Zefan Committed by Steven Rostedt

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: default avatarLi Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4B4E8735.6070604@cn.fujitsu.com>
Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 285caad4
...@@ -275,9 +275,10 @@ static int regex_match_middle(char *str, struct regex *r, int len) ...@@ -275,9 +275,10 @@ static int regex_match_middle(char *str, struct regex *r, int len)
static int regex_match_end(char *str, struct regex *r, int len) static int regex_match_end(char *str, struct regex *r, int len)
{ {
char *ptr = strstr(str, r->pattern); int strlen = len - 1;
if (ptr && (ptr[r->len] == 0)) if (strlen >= r->len &&
memcmp(str + strlen - r->len, r->pattern, r->len) == 0)
return 1; return 1;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment