mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Priyanshu Singh <singhpriyanshu9838@gmail.com>
To: Nathan Chancellor <nathan@kernel.org>, Nicolas Schier <nsc@kernel.org>
Cc: Julian Braha <julianbraha@gmail.com>,
	"Yann E . MORIN" <yann.morin.1998@free.fr>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Priyanshu Singh <singhpriyanshu9838@gmail.com>
Subject: [PATCH v2 1/2] kconfig: randconfig: parse KCONFIG_SEED with strtoull()
Date: Tue,  1 Dec 2026 06:22:09 +0000	[thread overview]
Message-ID: <20261201062210.88995-2-singhpriyanshu9838@gmail.com> (raw)
In-Reply-To: <20261201062210.88995-1-singhpriyanshu9838@gmail.com>

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@gmail.com>
---
 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


  reply	other threads:[~2026-12-01  6:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  6:22 [PATCH v2 0/2] kconfig: randconfig: fix 32-bit KCONFIG_SEED replay and add validation Priyanshu Singh
2026-12-01  6:22 ` Priyanshu Singh [this message]
2026-12-01  6:22 ` [PATCH v2 2/2] kconfig: randconfig: validate KCONFIG_SEED and add tests Priyanshu Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201062210.88995-2-singhpriyanshu9838@gmail.com \
    --to=singhpriyanshu9838@gmail.com \
    --cc=julianbraha@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®