Re: [RFC PATCH 1/1] vsprintf: Warn on integer scanning overflows

From: Andy Shevchenko
Date: Thu Jun 08 2023 - 12:26:27 EST


On Thu, Jun 08, 2023 at 06:14:33PM +0200, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
> > Von: "Andy Shevchenko" <andriy.shevchenko@xxxxxxxxxxxxxxx>
> >> if (prefix_chars < max_chars) {
> >> rv = _parse_integer_limit(cp, base, &result, max_chars - prefix_chars);
> >> + WARN_ON_ONCE(rv & KSTRTOX_OVERFLOW);
> >
> > This seems incorrect. simple_strto*() are okay to overflow. It's by design.
>
> Is this design decision also known to all users of scanf functions in the kernel?

We have test_scanf.c. Does it miss any test cases? Please add them!

--
With Best Regards,
Andy Shevchenko