]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
initrd: Replace simple_strtol with kstrtoint to improve ramdisk_start_setup
authorThorsten Blum <thorsten.blum@linux.dev>
Thu, 18 Sep 2025 16:24:47 +0000 (18:24 +0200)
committerChristian Brauner <brauner@kernel.org>
Fri, 31 Oct 2025 09:12:32 +0000 (10:12 +0100)
commitb2c43efc3c8d9cda34eb8421249d15e6fed4d650
tree79af29e13ae947fd80d2832a43fe0020f26d3b8f
parent3a8660878839faadb4f1a6dd72c3179c1df56787
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 <thorsten.blum@linux.dev>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
init/do_mounts_rd.c