提交 44e9c8b7 编写于 作者: L Li Zefan 提交者: Ingo Molnar

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: NLi Zefan <lizf@cn.fujitsu.com>
Acked-by: NTom Zanussi <tzanussi@gmail.com>
Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <49E04CF0.3010105@cn.fujitsu.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 a3e0ab05
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册