Skip to content

Commit af06a40

Browse files
tobluxakpm00
authored andcommitted
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>
1 parent 40cd0e8 commit af06a40

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

init/calibrate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
unsigned long lpj_fine;
1616
unsigned long preset_lpj;
17+
1718
static int __init lpj_setup(char *str)
1819
{
19-
preset_lpj = simple_strtoul(str,NULL,0);
20-
return 1;
20+
return kstrtoul(str, 0, &preset_lpj) == 0;
2121
}
2222

2323
__setup("lpj=", lpj_setup);

0 commit comments

Comments
 (0)