Re: [PATCH] kstrtox: delete saturation in case of overflow

From: Andy Shevchenko

Date: Fri Sep 18 2026 - 02:19:56 EST


On Thu, Sep 17, 2026 at 07:17:07PM +0300, Alexey Dobriyan wrote:
> From 161367fd1e8b41e938274923bbb3d26de69f7a7e Mon Sep 17 00:00:00 2001
> From: Alexey Dobriyan <adobriyan@xxxxxxxxx>
> Date: Thu, 17 Sep 2026 18:49:18 +0300
> Subject: [PATCH 1/1] kstrtox: delete saturation in case of overflow

Dunno if this is okay to have in the body. I think you need to use some korg
tools to send mails in a better way.

> Partially revert
>
> commit 6e30111dbb4075e3c26c230417b32bc4a1c66831
> lib: fix _parse_integer_limit() to handle overflow

The reference to the commit is standardized:
commit 6e30111dbb40 ("lib: fix _parse_integer_limit() to handle overflow")

> Originally, kstrto* was written in a way to keep simple_strto*()
> functions as is, so that they continue to return incorrect result
> if integer overflow occurs.
>
> Saturation doesn't do anything useful, it just creates second incorrect
> value and potentially breaks simple_strto*() users.
>
> Caller can decide to saturate itself anyway.
>
> Move saturation to memparse() from where the idea came from.

I don't see the use of this saturation, so perhaps we indeed can live without
it as before (note, I haven't checked any POSIX/C standards for the conversions,
dunno if they specify that kind of behaviour).

...

All above assuming that test cases are passed as before.

--
With Best Regards,
Andy Shevchenko