aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
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 0a367362ba2f..290e9da7aa9a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -92,9 +92,16 @@ void trace_wake_up(void)
92 92
93static int __init set_nr_entries(char *str) 93static int __init set_nr_entries(char *str)
94{ 94{
95 unsigned long nr_entries;
96 int ret;
97
95 if (!str) 98 if (!str)
96 return 0; 99 return 0;
97 trace_nr_entries = simple_strtoul(str, &str, 0); 100 ret = strict_strtoul(str, 0, &nr_entries);
101 /* nr_entries can not be zero */
102 if (ret < 0 || nr_entries == 0)
103 return 0;
104 trace_nr_entries = nr_entries;
98 return 1; 105 return 1;
99} 106}
100__setup("trace_entries=", set_nr_entries); 107__setup("trace_entries=", set_nr_entries);
@@ -1995,8 +2002,9 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf,
1995 size_t cnt, loff_t *ppos) 2002 size_t cnt, loff_t *ppos)
1996{ 2003{
1997 struct trace_array *tr = filp->private_data; 2004 struct trace_array *tr = filp->private_data;
1998 long val;
1999 char buf[64]; 2005 char buf[64];
2006 long val;
2007 int ret;
2000 2008
2001 if (cnt >= sizeof(buf)) 2009 if (cnt >= sizeof(buf))
2002 return -EINVAL; 2010 return -EINVAL;
@@ -2006,7 +2014,9 @@ tracing_ctrl_write(struct file *filp, const char __user *ubuf,
2006 2014
2007 buf[cnt] = 0; 2015 buf[cnt] = 0;
2008 2016
2009 val = simple_strtoul(buf, NULL, 10); 2017 ret = strict_strtoul(buf, 10, &val);
2018 if (ret < 0)
2019 return ret;
2010 2020
2011 val = !!val; 2021 val = !!val;
2012 2022
@@ -2110,8 +2120,9 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf,
2110 size_t cnt, loff_t *ppos) 2120 size_t cnt, loff_t *ppos)
2111{ 2121{
2112 long *ptr = filp->private_data; 2122 long *ptr = filp->private_data;
2113 long val;
2114 char buf[64]; 2123 char buf[64];
2124 long val;
2125 int ret;
2115 2126
2116 if (cnt >= sizeof(buf)) 2127 if (cnt >= sizeof(buf))
2117 return -EINVAL; 2128 return -EINVAL;
@@ -2121,7 +2132,9 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf,
2121 2132
2122 buf[cnt] = 0; 2133 buf[cnt] = 0;
2123 2134
2124 val = simple_strtoul(buf, NULL, 10); 2135 ret = strict_strtoul(buf, 10, &val);
2136 if (ret < 0)
2137 return ret;
2125 2138
2126 *ptr = val * 1000; 2139 *ptr = val * 1000;
2127 2140
@@ -2376,6 +2389,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
2376{ 2389{
2377 unsigned long val; 2390 unsigned long val;
2378 char buf[64]; 2391 char buf[64];
2392 int ret;
2379 2393
2380 if (cnt >= sizeof(buf)) 2394 if (cnt >= sizeof(buf))
2381 return -EINVAL; 2395 return -EINVAL;
@@ -2385,7 +2399,9 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
2385 2399
2386 buf[cnt] = 0; 2400 buf[cnt] = 0;
2387 2401
2388 val = simple_strtoul(buf, NULL, 10); 2402 ret = strict_strtoul(buf, 10, &val);
2403 if (ret < 0)
2404 return ret;
2389 2405
2390 /* must have at least 1 entry */ 2406 /* must have at least 1 entry */
2391 if (!val) 2407 if (!val)