lkml.org 
[lkml]   [2009]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 3/4] tracing/filters: operand can be negative
    This should be a bug:

    # cat format
    name: foo_bar
    ID: 71
    format:
    ...
    field:int bar; offset:24; size:4;
    # echo 'bar < 0' > filter
    # echo 'bar < -1' > filter
    bash: echo: write error: Invalid argument

    [ Impact: fix to allow negative operand in filer expr ]

    Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
    ---
    kernel/trace/trace_events_filter.c | 7 ++++++-
    1 files changed, 6 insertions(+), 1 deletions(-)

    diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
    index db6e54b..1d81923 100644
    --- a/kernel/trace/trace_events_filter.c
    +++ b/kernel/trace/trace_events_filter.c
    @@ -546,6 +546,7 @@ static int filter_add_pred(struct filter_parse_state *ps,
    filter_pred_fn_t fn;
    unsigned long long val;
    int string_type;
    + int ret;

    pred->fn = filter_pred_none;

    @@ -581,7 +582,11 @@ static int filter_add_pred(struct filter_parse_state *ps,
    pred->not = 1;
    return filter_add_pred_fn(ps, call, pred, fn);
    } else {
    - if (strict_strtoull(pred->str_val, 0, &val)) {
    + if (field->is_signed)
    + ret = strict_strtoll(pred->str_val, 0, &val);
    + else
    + ret = strict_strtoull(pred->str_val, 0, &val);
    + if (ret) {
    parse_error(ps, FILT_ERR_ILLEGAL_INTVAL, 0);
    return -EINVAL;
    }
    --
    1.5.4.rc3



    \
     
     \ /
      Last update: 2009-06-15 04:59    [W:0.020 / U:64.616 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site