[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-751e9983ee276cb150e8812b1d995f6035a63878@git.kernel.org>
Date: Sat, 16 Jan 2010 09:42:54 GMT
From: tip-bot for Li Zefan <lizf@...fujitsu.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
fweisbec@...il.com, rostedt@...dmis.org, lizf@...fujitsu.com,
tglx@...utronix.de
Subject: [tip:tracing/urgent] ftrace: Fix MATCH_END_ONLY function filter
Commit-ID: 751e9983ee276cb150e8812b1d995f6035a63878
Gitweb: http://git.kernel.org/tip/751e9983ee276cb150e8812b1d995f6035a63878
Author: Li Zefan <lizf@...fujitsu.com>
AuthorDate: Thu, 14 Jan 2010 10:53:02 +0800
Committer: Steven Rostedt <rostedt@...dmis.org>
CommitDate: Thu, 14 Jan 2010 22:38:03 -0500
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@...fujitsu.com>
LKML-Reference: <4B4E870E.6060607@...fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@...il.com>
Signed-off-by: Steven Rostedt <rostedt@...dmis.org>
---
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 7968762..1e6640f 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)
static int ftrace_match(char *str, char *regex, int len, int type)
{
int matched = 0;
- char *ptr;
+ int slen;
switch (type) {
case MATCH_FULL:
@@ -1706,8 +1706,8 @@ static int ftrace_match(char *str, char *regex, int len, int type)
matched = 1;
break;
case MATCH_END_ONLY:
- ptr = strstr(str, regex);
- if (ptr && (ptr[len] == 0))
+ slen = strlen(str);
+ if (slen >= len && memcmp(str + slen - len, regex, len) == 0)
matched = 1;
break;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists