Re: [PATCH v2 5/5] kconfig: use unsigned integers for hex range checks

From: Nicolas Schier

Date: Thu Sep 17 2026 - 14:10:57 EST


On Tue, Sep 15, 2026 at 10:15:08PM +0100, Julian Braha wrote:
> While 'hex' values should use the bounds of 64-bit unsigned integers, the
> range values are treated as signed (checks use strtoll).
>
> For example:
>
> config HEX_RANGE
> hex
> range 0 0xfffffffffffffffe
> default 0xffffffffffffffff
>
> the default value should adjust down to the upper bound of
> 0xfffffffffffffffe, but since the check incorrectly parses both as
> LLONG_MAX, the value stays at the out-of-range default of
> 0xffffffffffffffff.
>
> To fix this, let's use a union of signed and unsigned integers to
> represent both 'int' and 'hex' range values, then use both strtoll and
> strtoull where appropriate.
>
> Assisted-by: LLM
> Signed-off-by: Julian Braha <julianbraha@xxxxxxxxx>
> ---
> scripts/kconfig/symbol.c | 41 ++++++++++++++-----
> .../kconfig/tests/warn_changed_input/Kconfig | 5 +++
> .../tests/warn_changed_input/expected_config | 1 +
> 3 files changed, 36 insertions(+), 11 deletions(-)
>

Thanks for the whole patch-set, I appreciate your clean-up and
strengthening of kconfig!

Reviewed-by: Nicolas Schier <n.schier@xxxxxxxxx>

Kind regards,
Nicolas