From: Li Zefan Date: Thu, 14 Jan 2010 02:54:11 +0000 (+0800) Subject: tracing/filters: Fix MATCH_MIDDLE_ONLY filter matching X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b2af211f284eb1bef19fbb85fc8ef551bb1e7460;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git tracing/filters: Fix MATCH_MIDDLE_ONLY filter matching The @str might not be NULL-terminated if it's of type DYN_STRING or STATIC_STRING, so we should use strnstr() instead of strstr(). Signed-off-by: Li Zefan LKML-Reference: <4B4E8753.2000102@cn.fujitsu.com> Acked-by: Frederic Weisbecker Signed-off-by: Steven Rostedt --- diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 49e44dd17851..f364b085397e 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -268,7 +268,7 @@ static int regex_match_front(char *str, struct regex *r, int len) static int regex_match_middle(char *str, struct regex *r, int len) { - if (strstr(str, r->pattern)) + if (strnstr(str, r->pattern, len)) return 1; return 0; }