lkml.org 
[lkml]   [2009]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[tip:tracing/urgent] tracing/filters: return proper error code when writing filter file
    Commit-ID:  44e9c8b7adc52079f0535f9de0c2c2477831389b
    Gitweb: http://git.kernel.org/tip/44e9c8b7adc52079f0535f9de0c2c2477831389b
    Author: Li Zefan <lizf@cn.fujitsu.com>
    AuthorDate: Sat, 11 Apr 2009 15:55:28 +0800
    Committer: Ingo Molnar <mingo@elte.hu>
    CommitDate: Sun, 12 Apr 2009 11:59:29 +0200

    tracing/filters: return proper error code when writing filter file

    - propagate return value of filter_add_pred() to the user

    - return -ENOSPC but not -ENOMEM or -EINVAL when the filter array
    is full

    Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
    Acked-by: Tom Zanussi <tzanussi@gmail.com>
    Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    LKML-Reference: <49E04CF0.3010105@cn.fujitsu.com>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>


    ---
    kernel/trace/trace_events.c | 10 ++++++----
    kernel/trace/trace_events_filter.c | 4 ++--
    2 files changed, 8 insertions(+), 6 deletions(-)

    diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
    index 054bc18..576f4fa 100644
    --- a/kernel/trace/trace_events.c
    +++ b/kernel/trace/trace_events.c
    @@ -521,9 +521,10 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
    return cnt;
    }

    - if (filter_add_pred(call, pred)) {
    + err = filter_add_pred(call, pred);
    + if (err < 0) {
    filter_free_pred(pred);
    - return -EINVAL;
    + return err;
    }

    *ppos += cnt;
    @@ -588,10 +589,11 @@ subsystem_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
    return cnt;
    }

    - if (filter_add_subsystem_pred(system, pred)) {
    + err = filter_add_subsystem_pred(system, pred);
    + if (err < 0) {
    filter_free_subsystem_preds(system);
    filter_free_pred(pred);
    - return -EINVAL;
    + return err;
    }

    *ppos += cnt;
    diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
    index 49b3ef5..e03cbf1 100644
    --- a/kernel/trace/trace_events_filter.c
    +++ b/kernel/trace/trace_events_filter.c
    @@ -215,7 +215,7 @@ static int __filter_add_pred(struct ftrace_event_call *call,
    }
    }

    - return -ENOMEM;
    + return -ENOSPC;
    }

    static int is_string_field(const char *type)
    @@ -319,7 +319,7 @@ int filter_add_subsystem_pred(struct event_subsystem *system,
    }

    if (i == MAX_FILTER_PRED)
    - return -EINVAL;
    + return -ENOSPC;

    events_for_each(call) {
    int err;

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