提交 e6e7a65a 编写于 作者: F Frederic Weisbecker 提交者: Ingo Molnar

tracing/ftrace: fix unexpected -EINVAL when longest tracer name is set

Impact: fix confusing write() -EINVAL when changing the tracer

The following commit d9e54076 remade
alive the bug which made the set of a new tracer returning -EINVAL if
this is the longest name of tracer. This patch corrects it.
Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 ee02a2e5
...@@ -2655,6 +2655,9 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf, ...@@ -2655,6 +2655,9 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
char buf[max_tracer_type_len+1]; char buf[max_tracer_type_len+1];
int i; int i;
size_t ret; size_t ret;
int err;
ret = cnt;
if (cnt > max_tracer_type_len) if (cnt > max_tracer_type_len)
cnt = max_tracer_type_len; cnt = max_tracer_type_len;
...@@ -2668,12 +2671,11 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf, ...@@ -2668,12 +2671,11 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
for (i = cnt - 1; i > 0 && isspace(buf[i]); i--) for (i = cnt - 1; i > 0 && isspace(buf[i]); i--)
buf[i] = 0; buf[i] = 0;
ret = tracing_set_tracer(buf); err = tracing_set_tracer(buf);
if (!ret) if (err)
ret = cnt; return err;
if (ret > 0) filp->f_pos += ret;
filp->f_pos += ret;
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册