Re: [PATCH v8 2/5] lib: fix memparse() to handle overflow

From: Dmitry Antipov

Date: Wed Feb 25 2026 - 02:00:40 EST


On Tue, 2026-02-24 at 14:15 +0000, Rodrigo Alencar wrote:

> > I am interested on having _parse_integer_limit() overflow check
> > exposed to kernel modules.

Hm... _parse_integer_limit() may be EXPORT_SYMBOL()ed of course.
But are you sure that current API is not enough for your task?

> > ...
>
> I could propose the exposure of simple_strntoull() which is private
> to lib/vsprintf.c, slightly changing its prototype:
>
> * from:
> unsigned long long simple_strntoull(const char *startp,
>     char **endp,
>     unsigned int base,
>     size_t max_chars)
> * to:
> int simple_strntoull(const char *startp,
>      char **endp,
>      unsigned long long *result,
>      unsigned int base,
>      size_t max_chars)
>
> That would allow to tackle the FIXME tag. I suppose it is there
> because the overflow flag is being ignored, so the returned integer
> can be set to -ERANGE or -EOVERFLOW when overflow happens.

Well, removal of KSTRTOX_OVERFLOW quirk may be a subject for the next series.

Dmitry