aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2008-10-04 16:04:44 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-14 04:39:22 -0400
commitc2931e05ec5965597cbfb79ad332d4a29aeceb23 (patch)
treee1825834156ab83e7c5ed1bbd33c958e5da78b39 /kernel/trace
parent3ea2e6d71aafe35b8aaf89ed711a283815acfae6 (diff)
ftrace: return an error when setting a nonexistent tracer
When one try to set a nonexistent tracer, no error is returned as if the name of the tracer was correct. We should return -EINVAL. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index caa4051ce778..78d56614c95b 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2381,9 +2381,11 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
2381 struct tracer *t; 2381 struct tracer *t;
2382 char buf[max_tracer_type_len+1]; 2382 char buf[max_tracer_type_len+1];
2383 int i; 2383 int i;
2384 size_t ret;
2384 2385
2385 if (cnt > max_tracer_type_len) 2386 if (cnt > max_tracer_type_len)
2386 cnt = max_tracer_type_len; 2387 cnt = max_tracer_type_len;
2388 ret = cnt;
2387 2389
2388 if (copy_from_user(&buf, ubuf, cnt)) 2390 if (copy_from_user(&buf, ubuf, cnt))
2389 return -EFAULT; 2391 return -EFAULT;
@@ -2399,7 +2401,11 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
2399 if (strcmp(t->name, buf) == 0) 2401 if (strcmp(t->name, buf) == 0)
2400 break; 2402 break;
2401 } 2403 }
2402 if (!t || t == current_trace) 2404 if (!t) {
2405 ret = -EINVAL;
2406 goto out;
2407 }
2408 if (t == current_trace)
2403 goto out; 2409 goto out;
2404 2410
2405 if (current_trace && current_trace->reset) 2411 if (current_trace && current_trace->reset)
@@ -2412,9 +2418,10 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,
2412 out: 2418 out:
2413 mutex_unlock(&trace_types_lock); 2419 mutex_unlock(&trace_types_lock);
2414 2420
2415 filp->f_pos += cnt; 2421 if (ret == cnt)
2422 filp->f_pos += cnt;
2416 2423
2417 return cnt; 2424 return ret;
2418} 2425}
2419 2426
2420static ssize_t 2427static ssize_t