On Fri, Feb 19, 2016 at 01:27:50PM -0500, Joseph Bisch wrote: > This fixes the checkpatch.pl warning: > > WARNING: simple_strtoul is obsolete, use kstrtoul instead > > Signed-off-by: Joseph Bisch <joseph.bisch@xxxxxxxxx> > --- > drivers/staging/speakup/kobjects.c | 12 ++++++++++-- > drivers/staging/speakup/main.c | 6 +++++- > drivers/staging/speakup/varhandlers.c | 6 +++++- > 3 files changed, 20 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c > index fdfeb42..8eb4fdf 100644 > --- a/drivers/staging/speakup/kobjects.c > +++ b/drivers/staging/speakup/kobjects.c > @@ -126,6 +126,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj, > int do_characters = !strcmp(attr->attr.name, "characters"); > size_t desc_length = 0; > int i; > + int err; > > spin_lock_irqsave(&speakup_info.spinlock, flags); > while (cp < end) { > @@ -153,7 +154,10 @@ static ssize_t chars_chartab_store(struct kobject *kobj, > continue; > } > > - index = simple_strtoul(cp, &temp, 10); > + temp = cp; > + err = kstrtoul(temp, 10, &index); > + if (err) > + return err; > if (index > 255) { > rejected++; > cp = linefeed + 1; > @@ -754,6 +758,7 @@ static ssize_t message_store_helper(const char *buf, size_t count, > int used = 0; > int rejected = 0; > int reset = 0; > + int err; > enum msg_index_t firstmessage = group->start; > enum msg_index_t lastmessage = group->end; > enum msg_index_t curmessage; > @@ -783,7 +788,10 @@ static ssize_t message_store_helper(const char *buf, size_t count, > continue; > } > > - index = simple_strtoul(cp, &temp, 10); > + temp = cp; > + err = kstrtoul(temp, 10, &index); > + if (err) > + return err; > > while ((temp < linefeed) && (*temp == ' ' || *temp == '\t')) > temp++; > diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c > index 30cf973..9add4ab 100644 > --- a/drivers/staging/speakup/main.c > +++ b/drivers/staging/speakup/main.c > @@ -1904,6 +1904,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) > static int num; > int maxlen; > char *cp; > + int ret; > > if (type == KT_SPKUP && ch == SPEAKUP_GOTO) > goto do_goto; > @@ -1940,7 +1941,10 @@ oops: > return 1; > } > > - goto_pos = simple_strtoul(goto_buf, &cp, 10); > + cp = goto_buf; > + ret = kstrtoul(cp, 10, &goto_pos); > + if (ret) > + return ret; > > if (*cp == 'x') { > if (*goto_buf < '0') > diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c > index ab4fe8d..7a640e3 100644 > --- a/drivers/staging/speakup/varhandlers.c > +++ b/drivers/staging/speakup/varhandlers.c > @@ -324,8 +324,12 @@ char *spk_strlwr(char *s) > char *spk_s2uchar(char *start, char *dest) > { > int val; > + int ret; > > - val = simple_strtoul(skip_spaces(start), &start, 10); > + start = skip_spaces(start); > + ret = kstrtoul(start, 10, (unsigned long *)&val); You can't cast this variable like this, it could overwrite other areas on the stack when it is accessed :( _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel