diff options
-rw-r--r-- | kernel/trace/trace_events_filter.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 11c3973e6552..49e44dd17851 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 | ||
276 | static int regex_match_end(char *str, struct regex *r, int len) | 276 | static 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 | } |