lkml.org 
[lkml]   [2009]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 1/4] ftrace: Fix MATCH_END_ONLY filter matching
    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>
    ---
    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 e51a1bc..613dfb1 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 && memcpy(str + slen - len, regex, len))
    matched = 1;
    break;
    }
    --
    1.6.3


    \
     
     \ /
      Last update: 2009-12-11 11:01    [W:0.022 / U:29.640 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site