linux/scripts/kconfig/tests
Julian Braha 9b8719973e
kconfig: use unsigned integers for hex range checks
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@gmail.com>
Reviewed-by: Nicolas Schier <n.schier@fritz.com>
Link: https://patch.msgid.link/20260915211508.291790-6-julianbraha@gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
2026-09-17 16:31:01 -07:00
..
auto_submenu kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00
choice kconfig: remove tristate choice support 2024-07-16 01:08:36 +09:00
choice_randomize kconfig: tests: add a test for randconfig with dependent choices 2024-03-21 02:39:55 +09:00
choice_randomize2 kconfig: tests: test dependency after shuffling choices 2024-03-21 02:40:39 +09:00
conditional_dep kconfig: Support conditional deps using "depends on X if Y" 2026-01-06 14:57:15 -07:00
err_num_bounds kconfig: prevent out-of-bounds user input for numeric options 2026-09-17 16:31:00 -07:00
err_num_mismatch kconfig: check for hex and int mismatches 2026-09-17 16:31:00 -07:00
err_num_non_numeric_ref kconfig: check for out-of-bounds numeric constants 2026-09-17 16:31:00 -07:00
err_recursive_dep kconfig: error out for recursive range 2026-08-31 16:56:48 -07:00
err_recursive_inc kconfig: tests: fix recursive inclusion unit test 2019-06-05 02:33:10 +09:00
err_repeated_inc kconfig: Fix repeated include selftest expectation 2026-06-05 19:24:49 +02:00
err_transitional kconfig: Add transitional symbol attribute for migration support 2025-09-24 14:23:35 -07:00
new_choice_with_dep kconfig: convert to SPDX License Identifier 2018-12-28 22:22:28 +09:00
no_write_if_dep_unmet kconfig: tests: fix typo in comment 2026-06-09 16:28:46 -07:00
preprocess kconfig: test: add Kconfig macro language tests 2018-05-29 03:31:19 +09:00
savedefconfig_range kconfig: fix extra output from savedefconfig on out-of-range defaults 2026-09-17 16:19:02 -07:00
transitional kconfig: Avoid prompting for transitional symbols 2025-10-07 08:21:23 -07:00
warn_changed_input kconfig: use unsigned integers for hex range checks 2026-09-17 16:31:01 -07:00
warn_num_bounds kconfig: prevent out-of-bounds user input for numeric options 2026-09-17 16:31:00 -07:00
conftest.py kconfig: add optional warnings for changed input values 2026-06-18 11:46:32 -07:00
pytest.ini