From: Thorsten Blum Date: Thu, 18 Sep 2025 16:24:47 +0000 (+0200) Subject: initrd: Replace simple_strtol with kstrtoint to improve ramdisk_start_setup X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2c43efc3c8d9cda34eb8421249d15e6fed4d650;p=thirdparty%2Flinux.git initrd: Replace simple_strtol with kstrtoint to improve ramdisk_start_setup Replace simple_strtol() with the recommended kstrtoint() for parsing the 'ramdisk_start=' boot parameter. Unlike simple_strtol(), which returns a a long, kstrtoint() converts the string directly to an integer and avoids implicit casting. Check the return value of kstrtoint() and reject invalid values. This adds error handling while preserving existing behavior for valid values, and removes use of the deprecated simple_strtol() helper. Signed-off-by: Thorsten Blum Reviewed-by: Jan Kara Signed-off-by: Christian Brauner --- diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c index 19d9f33dcacf..eddbe5cb0413 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c @@ -29,8 +29,7 @@ int __initdata rd_image_start; /* starting block # of image */ static int __init ramdisk_start_setup(char *str) { - rd_image_start = simple_strtol(str,NULL,0); - return 1; + return kstrtoint(str, 0, &rd_image_start) == 0; } __setup("ramdisk_start=", ramdisk_start_setup);