[PATCH] staging: speakup: replace simple_strtoul() with kstrtoint()

Luis de Bethencourt luis at debethencourt.com
Wed Jun 24 10:19:27 UTC 2015


On Wed, Jun 24, 2015 at 10:53:30AM +0530, Sudip Mukherjee wrote:
> On Wed, Jun 24, 2015 at 12:15:52AM +0100, Luis de Bethencourt wrote:
> > On Wed, Jun 24, 2015 at 01:53:33AM +0300, Dan Carpenter wrote:
> > > Nope.  Your patch is totally wrong (buggy).  Please be more careful in
> > > the future.
> > > 
> > > regards,
> > > dan carpenter
> > > 
> > 
> > I saw other commits replace the obsolete simple_strtoul() this way and the
> > documentation makes it look like it is a 1 to 1 replacement.
> > 
> > Sorry about this. I will investigate further to understand why this is buggy
> > and be more careful in the future.
> simple_strtoul returns unsigned long and kstrtoint gives int.
> documentation says to use kstrtoul.
> 
> regards
> sudip

Hello again Sudip :)

simple_strtoul returns an unsigned long, but in this case this is downcasted to
int val. If we use kstrtoul there would be a type warning since the function
expects the reference to an unsigned long. Which is why I used the related
kstrtoint.

Dan has said this is buggy. I have an idea why this might be. I am isolating
the code and playing with it before submitting a second version.

Thanks for the review.

Luis


More information about the devel mailing list