From: Al Viro <v...@zeniv.linux.org.uk> now we don't need the glob substring being matched to get NUL-terminated by filter_parse_regex()
Signed-off-by: Al Viro <v...@zeniv.linux.org.uk> --- kernel/trace/ftrace.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 9f90a4f..6cb104a 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -3365,24 +3365,26 @@ ftrace_notrace_open(struct inode *inode, struct file *file) static int ftrace_match(char *str, char *regex, int len, int type) { int matched = 0; - int slen; + int slen = strlen(str); + + if (slen < len) + return 0; switch (type) { case MATCH_FULL: - if (strcmp(str, regex) == 0) + if (slen == len && memcmp(str, regex, len) == 0) matched = 1; break; case MATCH_FRONT_ONLY: - if (strncmp(str, regex, len) == 0) + if (memcmp(str, regex, len) == 0) matched = 1; break; case MATCH_MIDDLE_ONLY: - if (strstr(str, regex)) + if (memmem(str, slen, regex, len)) matched = 1; break; case MATCH_END_ONLY: - slen = strlen(str); - if (slen >= len && memcmp(str + slen - len, regex, len) == 0) + if (memcmp(str + slen - len, regex, len) == 0) matched = 1; break; } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/