Hi Priyanshu, On 11/27/26 01:59, Priyanshu Singh wrote: > Hi Julian, > > Thanks for the review! > > On 11/25/26 23:30, Julian Braha wrote: >>> Switch to strtoull(..., 0) and consume trailing whitespace so >>> whitespace-padded seeds are not discarded. Reject 0b/0B prefixes >>> explicitly so C11 and C23 builds behave identically. >> C23 builds aren't supported yet. >> >>> Emit a warning whenever KCONFIG_SEED deviates from a canonical unsigned >>> 32-bit integer, and exit(1) if KCONFIG_WERROR is set. Otherwise, retain >> Yes, it would be good to improve the input validation for KCONFIG_SEED, >> especially to reject negative values. >> >> In a v2, could you make this part more explicit (add it to your bullet >> list of changes above?) > Sure, I will add negative values to the bullet list in v2. > > One quick clarification on negative values before I send v2: > Documentation/kbuild/kconfig.rst currently only states "You can set this > to the integer value used to seed the RNG" and does not explicitly > forbid negative integers. When KCONFIG_WERROR is unset, is emitting the > malformed-format warning while preserving modulo 2^32 truncation (and > exiting 1 under KCONFIG_WERROR) acceptable for backward compatibility, > or would you prefer negative values to fall back to the clock seed even > without KCONFIG_WERROR (along with updating kconfig.rst)? Negative values should probably use the clock seed fallback, but there's no need to update kconfig.rst for this. I really doubt that users might read "You can set this to the integer value used to seed the RNG" and think that includes negative integers. > >>> Fixes: 0d8024c6ebad ("kconfig: allow specifying the seed for randconfig") >> Improvements in input validation are good, but 'Fixes' is for bugs. > Agreed that input validation improvements shouldn't carry a Fixes tag. > However, on 32-bit hosts signed strtol() clamps seeds in > [0x80000000, 0xFFFFFFFF] to LONG_MAX (0x7FFFFFFF), so half of the seeds > printed by randconfig itself cannot be replayed on 32-bit hosts. > > should i split v2 into a 2-patch series? > - Patch 1 (with Fixes:): switch strtol() to strtoull() to fix 32-bit > replay of [0x80000000, 0xFFFFFFFF] seeds. > - Patch 2 (without Fixes:): add malformed input warnings (negative values, > whitespace, >UINT_MAX, garbage), KCONFIG_WERROR handling, trimmed > regression tests, and any Documentation/kbuild/kconfig.rst update. We don't really care about 32-bit hosts, but o/w yes: this approach is fine, I think. > >> In a v2, you can remove the changes for binary 0b/0B handling. > Makes sense, I will drop the 0b/0B handling in conf.c along with the > corresponding test cases and C23 mentions in v2. > >>> + seed = (unsigned int)val; >> This cast is unnecessary, you can just do 'seed = val;' > Will remove in v2. > >> This is *a lot* of test code for input validation of just 1 var. Could >> this be simplified at all? >> >> Is every test here absolutely necessary? > Definitely not, I will cut it by half or more in v2. Thanks! - Julian Braha