aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ring_buffer.c
diff options
context:
space:
mode:
authorPeter Huewe <peterhuewe@gmx.de>2011-06-07 15:58:27 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-06-14 22:48:50 -0400
commit22fe9b54d859e53bfbbbdc1a0a77a82bc453927c (patch)
tree4aec2d069decbe0786ad5474908f5bbe49732ad4 /kernel/trace/ring_buffer.c
parent749230b06a753a22f6ed96e5dd60815d6ab12865 (diff)
tracing: Convert to kstrtoul_from_user
This patch replaces the code for getting an unsigned long from a userspace buffer by a simple call to kstroul_from_user. This makes it easier to read and less error prone. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Link: http://lkml.kernel.org/r/1307476707-14762-1-git-send-email-peterhuewe@gmx.de Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r--kernel/trace/ring_buffer.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 725153d6cf73..f00ede314eb6 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -3980,20 +3980,11 @@ rb_simple_write(struct file *filp, const char __user *ubuf,
3980 size_t cnt, loff_t *ppos) 3980 size_t cnt, loff_t *ppos)
3981{ 3981{
3982 unsigned long *p = filp->private_data; 3982 unsigned long *p = filp->private_data;
3983 char buf[64];
3984 unsigned long val; 3983 unsigned long val;
3985 int ret; 3984 int ret;
3986 3985
3987 if (cnt >= sizeof(buf)) 3986 ret = kstrtoul_from_user(ubuf, cnt, 10, &val);
3988 return -EINVAL; 3987 if (ret)
3989
3990 if (copy_from_user(&buf, ubuf, cnt))
3991 return -EFAULT;
3992
3993 buf[cnt] = 0;
3994
3995 ret = strict_strtoul(buf, 10, &val);
3996 if (ret < 0)
3997 return ret; 3988 return ret;
3998 3989
3999 if (val) 3990 if (val)