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

init: Replace simple_strtoul() with kstrtouint() in root_delay_setup()

Replace deprecated simple_strtoul() with kstrtouint() for better error
handling and input validation. Return 0 on parsing failure to indicate
invalid parameter, maintaining existing behavior for valid inputs.

The simple_strtoul() function is deprecated in favor of kstrtoint()
family functions which provide better error handling and are recommended
for new code and replacements.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Link: https://patch.msgid.link/20251103080627.1844645-1-kaushlendra.kumar@intel.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Kaushlendra Kumar and committed by
Christian Brauner
a6446829 a4db63b8

+2 -1
+2 -1
init/do_mounts.c
··· 120 120 static unsigned int __initdata root_delay; 121 121 static int __init root_delay_setup(char *str) 122 122 { 123 - root_delay = simple_strtoul(str, NULL, 0); 123 + if (kstrtouint(str, 0, &root_delay)) 124 + return 0; 124 125 return 1; 125 126 } 126 127