Re: [PATCH v6 1/4] lib: new helper kstrtodev_t()

From: Pavel Machek
Date: Sat Apr 25 2020 - 03:07:18 EST


Hi!

> > > > Why simple_strto*() can't be used?
> > >
> > > I didn't really consider it, but looking in more detail I don't like it
> > > much. Without having tried it I think simple_strtoull accepts
> > > "1000000000000000000000000000000000000000000" returning some arbitrary
> > > value without an error indication.
> >
> > So what? User has a lot of possibilities to shoot into the foot.
> > Since you interpret this as device major:minor, not founding a device
> > will be first level of error, next one when your code will try to do
> > something out of it. It shouldn't be a problem of kstrtox generic
> > helpers.
>
> I fail to follow your argument here. In my eyes if the user writes a
> valid major:minor it should work, and if they write an invalid one this
> should result in an error and not a usage of a device that just happens
> to have the major:minor that simple_strtoull happens to return for the
> two components.

Yes please. We don't allow feet shooting where it is easy to prevent,
and that is the case here.

Best regards,
Pavel

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: Digital signature