diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2010-01-13 21:53:02 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-01-14 22:38:03 -0500 |
commit | 751e9983ee276cb150e8812b1d995f6035a63878 (patch) | |
tree | 7f9abfa2ea11bcc2ccfa9922af17811d5020fa69 /kernel | |
parent | b82a4045f7962483a78a874343dc6e31b79c96c1 (diff) |
ftrace: Fix MATCH_END_ONLY function filter
For '*foo' pattern, we should allow any string ending with
'foo', but ftrace filter incorrectly disallows strings
like bar_foo_foo:
# echo '*io' > set_ftrace_filter
# cat set_ftrace_filter | grep 'req_bio_endio'
# cat available_filter_functions | grep 'req_bio_endio'
req_bio_endio
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4B4E870E.6060607@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ftrace.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 7968762c8167..1e6640f80454 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1690,7 +1690,7 @@ ftrace_regex_lseek(struct file *file, loff_t offset, int origin) | |||
1690 | static int ftrace_match(char *str, char *regex, int len, int type) | 1690 | static int ftrace_match(char *str, char *regex, int len, int type) |
1691 | { | 1691 | { |
1692 | int matched = 0; | 1692 | int matched = 0; |
1693 | char *ptr; | 1693 | int slen; |
1694 | 1694 | ||
1695 | switch (type) { | 1695 | switch (type) { |
1696 | case MATCH_FULL: | 1696 | case MATCH_FULL: |
@@ -1706,8 +1706,8 @@ static int ftrace_match(char *str, char *regex, int len, int type) | |||
1706 | matched = 1; | 1706 | matched = 1; |
1707 | break; | 1707 | break; |
1708 | case MATCH_END_ONLY: | 1708 | case MATCH_END_ONLY: |
1709 | ptr = strstr(str, regex); | 1709 | slen = strlen(str); |
1710 | if (ptr && (ptr[len] == 0)) | 1710 | if (slen >= len && memcmp(str + slen - len, regex, len) == 0) |
1711 | matched = 1; | 1711 | matched = 1; |
1712 | break; | 1712 | break; |
1713 | } | 1713 | } |