diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-04-11 03:55:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-12 05:59:29 -0400 |
commit | 44e9c8b7adc52079f0535f9de0c2c2477831389b (patch) | |
tree | 4c021dd16a8329f8543a97310081724015c81fc6 /kernel | |
parent | a3e0ab050774117d4a6173087c8bf3888662a83f (diff) |
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_events.c | 10 | ||||
-rw-r--r-- | 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 054bc1802bcd..576f4fa2af0d 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, | |||
521 | return cnt; | 521 | return cnt; |
522 | } | 522 | } |
523 | 523 | ||
524 | if (filter_add_pred(call, pred)) { | 524 | err = filter_add_pred(call, pred); |
525 | if (err < 0) { | ||
525 | filter_free_pred(pred); | 526 | filter_free_pred(pred); |
526 | return -EINVAL; | 527 | return err; |
527 | } | 528 | } |
528 | 529 | ||
529 | *ppos += cnt; | 530 | *ppos += cnt; |
@@ -588,10 +589,11 @@ subsystem_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
588 | return cnt; | 589 | return cnt; |
589 | } | 590 | } |
590 | 591 | ||
591 | if (filter_add_subsystem_pred(system, pred)) { | 592 | err = filter_add_subsystem_pred(system, pred); |
593 | if (err < 0) { | ||
592 | filter_free_subsystem_preds(system); | 594 | filter_free_subsystem_preds(system); |
593 | filter_free_pred(pred); | 595 | filter_free_pred(pred); |
594 | return -EINVAL; | 596 | return err; |
595 | } | 597 | } |
596 | 598 | ||
597 | *ppos += cnt; | 599 | *ppos += cnt; |
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 49b3ef54ec46..e03cbf1e38f3 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, | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | return -ENOMEM; | 218 | return -ENOSPC; |
219 | } | 219 | } |
220 | 220 | ||
221 | static int is_string_field(const char *type) | 221 | static int is_string_field(const char *type) |
@@ -319,7 +319,7 @@ int filter_add_subsystem_pred(struct event_subsystem *system, | |||
319 | } | 319 | } |
320 | 320 | ||
321 | if (i == MAX_FILTER_PRED) | 321 | if (i == MAX_FILTER_PRED) |
322 | return -EINVAL; | 322 | return -ENOSPC; |
323 | 323 | ||
324 | events_for_each(call) { | 324 | events_for_each(call) { |
325 | int err; | 325 | int err; |