summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-04-18 16:05:40 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 19:45:21 +0200
commitd75d812f460cfb01cc7b98825f6bff30684a4629 (patch)
tree4880cc05f56bbce1bb2830dcffca9e410b0cd1f5 /kernel
parentdc8d0a6d5631fa4f3e70176d4b56b48b52995f3b (diff)
ftrace: replace simple_strtoul with strict_strtoul
Andrew Morton suggested using strict_strtoul over simple_strtoul. This patch replaces them in ftrace. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index be126cb63a64..2debc03766aa 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -92,9 +92,16 @@ void trace_wake_up(void)
static int __init set_nr_entries(char *str)
{
+ unsigned long nr_entries;
+ int ret;
+
if (!str)
return 0;
- trace_nr_entries = simple_strtoul(str, &str, 0);
+ ret = strict_strtoul(str, 0, &nr_entries);
+ /* nr_entries can not be zero */
+ if (ret < 0 || nr_entries == 0)
+ return 0;
+ trace_nr_entries = nr_entries;
return 1;
}
__setup("trace_entries=", set_nr_entries);
@@ -2037,8 +2044,9 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
struct trace_array *tr = filp->private_data;
- long val;
char buf[64];
+ long val;
+ int ret;
if (cnt >= sizeof(buf))
return -EINVAL;
@@ -2048,7 +2056,9 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf,
buf[cnt] = 0;
- val = simple_strtoul(buf, NULL, 10);
+ ret = strict_strtoul(buf, 10, &val);
+ if (ret < 0)
+ return ret;
val = !!val;
@@ -2152,8 +2162,9 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
long *ptr = filp->private_data;
- long val;
char buf[64];
+ long val;
+ int ret;
if (cnt >= sizeof(buf))
return -EINVAL;
@@ -2163,7 +2174,9 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf,
buf[cnt] = 0;
- val = simple_strtoul(buf, NULL, 10);
+ ret = strict_strtoul(buf, 10, &val);
+ if (ret < 0)
+ return ret;
*ptr = val * 1000;
@@ -2418,6 +2431,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
{
unsigned long val;
char buf[64];
+ int ret;
if (cnt >= sizeof(buf))
return -EINVAL;
@@ -2427,7 +2441,9 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
buf[cnt] = 0;
- val = simple_strtoul(buf, NULL, 10);
+ ret = strict_strtoul(buf, 10, &val);
+ if (ret < 0)
+ return ret;
/* must have at least 1 entry */
if (!val)