lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 03 Jun 2013 16:02:35 +0900
From:	Jingoo Han <jg1.han@...sung.com>
To:	'Andy Shevchenko' <andy.shevchenko@...il.com>
Cc:	'Samuel Ortiz' <sameo@...ux.intel.com>,
	linux-kernel@...r.kernel.org, 'Lee Jones' <lee.jones@...aro.org>,
	'Linus Walleij' <linus.walleij@...aro.org>,
	'Srinidhi Kasagar' <srinidhi.kasagar@...ricsson.com>,
	Jingoo Han <jg1.han@...sung.com>
Subject: Re: [PATCH] mfd: replace strict_strtoul() with kstrtoul()

On Sunday, June 02, 2013 7:51 PM, Andy Shevchenko wrote:
> On Sat, Jun 1, 2013 at 10:13 AM, Jingoo Han <jg1.han@...sung.com> wrote:
> > The usage of strict_strtoul() is not preferred, because
> > strict_strtoul() is obsolete. Thus, kstrtoul() should be
> > used.
> 
> > --- a/drivers/mfd/aat2870-core.c
> > +++ b/drivers/mfd/aat2870-core.c
> > @@ -312,7 +312,7 @@ static ssize_t aat2870_reg_write_file(struct file *file,
> >         while (*start == ' ')
> >                 start++;
> >
> > -       if (strict_strtoul(start, 16, &val))
> > +       if (kstrtoul(start, 16, &val))
> >                 return -EINVAL;
> 
> ret = kstrtoul(...);
> if (ret)
>  return ret;
> 
> > --- a/drivers/mfd/ab3100-core.c
> > +++ b/drivers/mfd/ab3100-core.c
> > @@ -514,13 +514,13 @@ static ssize_t ab3100_get_set_reg(struct file *file,
> >         /*
> >          * Advance pointer to end of string then terminate
> >          * the register string. This is needed to satisfy
> > -        * the strict_strtoul() function.
> > +        * the kstrtoul() function.
> >          */
> >         while ((i < buf_size) && (buf[i] != ' '))
> >                 i++;
> >         buf[i] = '\0';
> >
> > -       err = strict_strtoul(&buf[regp], 16, &user_reg);
> > +       err = kstrtoul(&buf[regp], 16, &user_reg);
> >         if (err)
> >                 return err;
> >         if (user_reg > 0xff)
> 
> user_reg couldn't be more than byte.
> So, you may change its definition to u8 and use here kstrtou8() and
> remove later check.

OK, I will change kstrtoul() to kstrtou8().

Best regards,
Jingoo Han

> 
> But on first glance on that function it could be optimized a lot
> (there are so many custom stuff like skip_space() and like that).
> 
> > @@ -557,7 +557,7 @@ static ssize_t ab3100_get_set_reg(struct file *file,
> >                         i++;
> >                 buf[i] = '\0';
> >
> > -               err = strict_strtoul(&buf[valp], 16, &user_value);
> > +               err = kstrtoul(&buf[valp], 16, &user_value);
> >                 if (err)
> >                         return err;
> >                 if (user_reg > 0xff)
> 
> Same idea here.
> 
> --
> With Best Regards,
> Andy Shevchenko

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ