Re: [PATCH 21/30] mm: Use kstrtobool() instead of strtobool()

From: Andy Shevchenko
Date: Wed Nov 02 2022 - 07:29:36 EST


On Tue, Nov 01, 2022 at 03:47:20PM -0700, Kees Cook wrote:
> On Tue, Nov 01, 2022 at 10:14:09PM +0100, Christophe JAILLET wrote:

...

> This seems in keeping with the removal of the simple_*str*() helpers:
> https://docs.kernel.org/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull

That piece of the documentation is partially wrong. Nobody will going to remove
simple_strtox() due to their convenience when it's related to parse something
from the stream. Yes, overflow is possible, but here is a trade-off.

Note, kstrtox() may not work at early boot stages when we need to parse stream
(with mixed digits and text and symbols) without acquiring space from the heap,
i.o.w. RO strings.

--
With Best Regards,
Andy Shevchenko