[PATCH v2 1/2] kconfig: randconfig: parse KCONFIG_SEED with strtoull()
From: Priyanshu Singh
Date: Tue Dec 01 2026 - 01:27:17 EST
set_randconfig_seed() parses KCONFIG_SEED with signed strtol(). On 32-bit
hosts where long is 32 bits, valid unsigned 32-bit seeds in
[0x80000000, 0xFFFFFFFF] exceed LONG_MAX (0x7FFFFFFF), so strtol() clamps
them to 0x7FFFFFFF. Since randconfig itself prints seeds via
"KCONFIG_SEED=0x%X\n", roughly half of all generated seeds fail to replay
accurately on 32-bit hosts.
Switch to strtoull() so the full 32-bit unsigned seed range parses
identically across 32-bit and 64-bit hosts.
Fixes: 0d8024c6ebad ("kconfig: allow specifying the seed for randconfig")
Signed-off-by: Priyanshu Singh <singhpriyanshu9838@xxxxxxxxx>
---
scripts/kconfig/conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 31c6fd25e6ec..11cf158c8b4e 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -94,7 +94,7 @@ static void set_randconfig_seed(void)
if (env && *env) {
char *endp;
- seed = strtol(env, &endp, 0);
+ seed = strtoull(env, &endp, 0);
if (*endp == '\0')
seed_set = true;
}
--
2.53.0