Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <thorsten.blum@linux.dev>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Thorsten Blum and committed by
Andrew Morton
af06a404 40cd0e8d

+2 -2
+2 -2
init/calibrate.c
··· 14 14 15 15 unsigned long lpj_fine; 16 16 unsigned long preset_lpj; 17 + 17 18 static int __init lpj_setup(char *str) 18 19 { 19 - preset_lpj = simple_strtoul(str,NULL,0); 20 - return 1; 20 + return kstrtoul(str, 0, &preset_lpj) == 0; 21 21 } 22 22 23 23 __setup("lpj=", lpj_setup);