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>
static int __init set_nr_entries(char *str)
{
static int __init set_nr_entries(char *str)
{
+ unsigned long nr_entries;
+ int ret;
+
- 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);
return 1;
}
__setup("trace_entries=", set_nr_entries);
size_t cnt, loff_t *ppos)
{
struct trace_array *tr = filp->private_data;
size_t cnt, loff_t *ppos)
{
struct trace_array *tr = filp->private_data;
if (cnt >= sizeof(buf))
return -EINVAL;
if (cnt >= sizeof(buf))
return -EINVAL;
- val = simple_strtoul(buf, NULL, 10);
+ ret = strict_strtoul(buf, 10, &val);
+ if (ret < 0)
+ return ret;
size_t cnt, loff_t *ppos)
{
long *ptr = filp->private_data;
size_t cnt, loff_t *ppos)
{
long *ptr = filp->private_data;
if (cnt >= sizeof(buf))
return -EINVAL;
if (cnt >= sizeof(buf))
return -EINVAL;
- val = simple_strtoul(buf, NULL, 10);
+ ret = strict_strtoul(buf, 10, &val);
+ if (ret < 0)
+ return ret;
{
unsigned long val;
char buf[64];
{
unsigned long val;
char buf[64];
if (cnt >= sizeof(buf))
return -EINVAL;
if (cnt >= sizeof(buf))
return -EINVAL;
- 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)
/* must have at least 1 entry */
if (!val)