diff options
| author | Dmitrii Tulnov <tulnov.dl@gmail.com> | 2026-09-19 00:34:30 +0300 |
|---|---|---|
| committer | Nathan Chancellor <nathan@kernel.org> | 2026-09-24 11:30:42 -0400 |
| commit | 9f01cd3a324390b235c67ae4ca3d35085369ebdd (patch) | |
| tree | f3c1e2b7c3d492abb5f3b9042b85357907de8e3f /scripts/stackusage | |
| parent | 36d4a11b56aa98da4b4652a2e34d229ffcf36070 (diff) | |
| download | linux-next-9f01cd3a324390b235c67ae4ca3d35085369ebdd.tar.gz linux-next-9f01cd3a324390b235c67ae4ca3d35085369ebdd.zip | |
kconfig: warn about malformed KCONFIG_PROBABILITY values
randconfig checks the numeric range of each probability but does not
validate where strtol() stops. For example, KCONFIG_PROBABILITY=50% is
accepted as 50:0:0: the '%' is parsed repeatedly as zero. For the
documented value 50, tristate y/m/n probabilities are 25%/25%/50%.
With 50%, both y/m probabilities silently become zero, reducing the
coverage of random configuration builds. Empty fields and extra fields
are also accepted.
Warn when the value does not follow the documented decimal format. For
malformed inputs whose parsed probabilities are in range, preserve the
existing interpretation unless KCONFIG_WERROR is set. In that case, exit
with an error before writing the configuration. Leading whitespace and
signs are accepted by strtol(), but also trigger the warning because they
are outside the documented format.
Keep the strtol() result as long until the range check. This rejects
out-of-range values that narrowing to int previously made valid, such as
4294967296 becoming zero on a 64-bit host, regardless of KCONFIG_WERROR.
Add regression tests for one warning per malformed input, preserved
configurations, KCONFIG_WERROR, out-of-range values, the supported
probability formats, and the documented empty-value default.
Fixes: e43956e60769 ("kconfig: implement KCONFIG_PROBABILITY for randconfig")
Assisted-by: LLM
Signed-off-by: Dmitrii Tulnov <tulnov.dl@gmail.com>
Tested-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Julian Braha <julianbraha@gmail.com>
Link: https://patch.msgid.link/20260918213430.3-1-tulnov.dl@gmail.com
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Diffstat (limited to 'scripts/stackusage')
0 files changed, 0 insertions, 0 deletions
