Commit cffae437 authored by Steven Rostedt's avatar Steven Rostedt Committed by Thomas Gleixner

ftrace: simple clean ups

Andrew Morton mentioned some clean ups that should be done to ftrace.
This patch does some of the simple clean ups.
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent afc2abc0
...@@ -36,8 +36,7 @@ unsigned long __read_mostly tracing_max_latency = (cycle_t)ULONG_MAX; ...@@ -36,8 +36,7 @@ unsigned long __read_mostly tracing_max_latency = (cycle_t)ULONG_MAX;
unsigned long __read_mostly tracing_thresh; unsigned long __read_mostly tracing_thresh;
/* dummy trace to disable tracing */ /* dummy trace to disable tracing */
static struct tracer no_tracer __read_mostly = static struct tracer no_tracer __read_mostly = {
{
.name = "none", .name = "none",
}; };
...@@ -1906,8 +1905,8 @@ tracing_iter_ctrl_write(struct file *filp, const char __user *ubuf, ...@@ -1906,8 +1905,8 @@ tracing_iter_ctrl_write(struct file *filp, const char __user *ubuf,
int neg = 0; int neg = 0;
int i; int i;
if (cnt > 63) if (cnt >= sizeof(buf))
cnt = 63; return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt)) if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT; return -EFAULT;
...@@ -1999,8 +1998,8 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf, ...@@ -1999,8 +1998,8 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf,
long val; long val;
char buf[64]; char buf[64];
if (cnt > 63) if (cnt >= sizeof(buf))
cnt = 63; return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt)) if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT; return -EFAULT;
...@@ -2099,10 +2098,10 @@ tracing_max_lat_read(struct file *filp, char __user *ubuf, ...@@ -2099,10 +2098,10 @@ tracing_max_lat_read(struct file *filp, char __user *ubuf,
char buf[64]; char buf[64];
int r; int r;
r = snprintf(buf, 64, "%ld\n", r = snprintf(buf, sizeof(buf), "%ld\n",
*ptr == (unsigned long)-1 ? -1 : nsecs_to_usecs(*ptr)); *ptr == (unsigned long)-1 ? -1 : nsecs_to_usecs(*ptr));
if (r > 64) if (r > sizeof(buf))
r = 64; r = sizeof(buf);
return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
} }
...@@ -2114,8 +2113,8 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf, ...@@ -2114,8 +2113,8 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf,
long val; long val;
char buf[64]; char buf[64];
if (cnt > 63) if (cnt >= sizeof(buf))
cnt = 63; return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt)) if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT; return -EFAULT;
...@@ -2378,8 +2377,8 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, ...@@ -2378,8 +2377,8 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
unsigned long val; unsigned long val;
char buf[64]; char buf[64];
if (cnt > 63) if (cnt >= sizeof(buf))
cnt = 63; return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt)) if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment