From: Thorsten Blum Date: Sat, 22 Nov 2025 11:45:37 +0000 (+0100) Subject: init: replace simple_strtoul with kstrtoul to improve lpj_setup X-Git-Tag: v6.19-rc1~70^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af06a40474793ad9677d1771c0624ae8191f0892;p=thirdparty%2Flinux.git init: replace simple_strtoul with kstrtoul to improve lpj_setup Replace simple_strtoul() with the recommended kstrtoul() for parsing the 'lpj=' boot parameter. Check the return value of kstrtoul() and reject invalid values. This adds error handling while preserving existing behavior for valid values, and removes use of the deprecated simple_strtoul() helper. Link: https://lkml.kernel.org/r/20251122114539.446937-2-thorsten.blum@linux.dev Signed-off-by: Thorsten Blum Cc: Christian Brauner Cc: Peter Zijlstra Signed-off-by: Andrew Morton --- diff --git a/init/calibrate.c b/init/calibrate.c index f3831272f1135..09c2e61021105 100644 --- a/init/calibrate.c +++ b/init/calibrate.c @@ -14,10 +14,10 @@ unsigned long lpj_fine; unsigned long preset_lpj; + static int __init lpj_setup(char *str) { - preset_lpj = simple_strtoul(str,NULL,0); - return 1; + return kstrtoul(str, 0, &preset_lpj) == 0; } __setup("lpj=", lpj_setup);