Re: [PATCH] staging: speakup: Replace simple_strtoul by kstrtoul

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I happened to search my gmail spam box for patches and found this.

On Fri, Apr 28, 2017 at 6:50 AM, Shekhar Bhandakkar
<cs14btech11006@xxxxxxxxxx> wrote:
> The simple_strtoul function is obsolete.
> This patch replaces it with kstrtoul.
>
> Signed-off-by: Shekhar Bhandakkar <cs14btech11006@xxxxxxxxxx>
> ---
>  drivers/staging/speakup/kobjects.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
> index ca85476..8a1ebe6 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -127,6 +127,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;

This is buggy.  "temp" is supposed to point to the end of the number.

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux