Messages in this thread | | | From | Geert Uytterhoeven <> | Date | Thu, 4 Jul 2019 09:14:50 +0200 | Subject | Re: [PATCH v2 1/2] kernel.h: Update comment about simple_strto<foo>() functions |
| |
Hi Andy,
On Wed, Jul 3, 2019 at 4:37 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > On Wed, Jun 26, 2019 at 01:00:45PM +0200, Geert Uytterhoeven wrote: > > On Wed, Jun 26, 2019 at 11:39 AM Andy Shevchenko > > <andriy.shevchenko@linux.intel.com> wrote: > > > --- a/include/linux/kernel.h > > > +++ b/include/linux/kernel.h > > > > > @@ -437,7 +435,15 @@ static inline int __must_check kstrtos32_from_user(const char __user *s, size_t > > > return kstrtoint_from_user(s, count, base, res); > > > } > > > > > > -/* Obsolete, do not use. Use kstrto<foo> instead */ > > > +/* > > > + * Use kstrto<foo> instead. > > > + * > > > + * NOTE: The simple_strto<foo> does not check for overflow and, > > > + * depending on the input, may give interesting results. > > > + * > > > + * Use these functions if and only if the code will need in place > > > + * conversion and otherwise looks very ugly. Keep in mind above caveat. > > > > What do you mean by "in place conversion"? > > The input buffer is const, and not modified by the callee. > > Do you mean that these functions do not require NUL termination (just > > after the number), and the characters making up the number don't have to > > be copied to a separate buffer to make them NUL-terminated? > > The second one, could you propose better wording for that?
What about:
"Use these functions if and only if you cannot use kstrto<foo>, because the number is not immediately followed by a NUL-character in the buffer. Keep in mind above caveat."
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
| |