Re: [PATCH] x86/lib: Fix num_digits() signed overflow for INT_MIN
From: H. Peter Anvin
Date: Tue Jan 20 2026 - 15:25:28 EST
On 2026-01-20 12:16, David Desobry wrote:
> I haven't hit this corner case in practice; I was just auditing the code and
> noticed the corner case overflow leading to wrong logic.
> Then in a v2 version I brought some design improvement (switch case).
The switch is a good improvement. I would say, though, that if we don't need
signed input then we should just take out the minus handling code and have the
function take an unsigned int as input.
-hpa