Commit af06a404 authored by Thorsten Blum's avatar Thorsten Blum Committed by Andrew Morton
Browse files

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: default avatarThorsten Blum <thorsten.blum@linux.dev>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 40cd0e8d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);