]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
brd: replace simple_strtol with kstrtoul in ramdisk_size
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 20 Dec 2025 23:59:23 +0000 (00:59 +0100)
committerJens Axboe <axboe@kernel.dk>
Sun, 28 Dec 2025 22:54:38 +0000 (15:54 -0700)
commite1418af7660f67abc7f6f0cf6867f3989aa45e9a
tree0928b072d76352342cb25083ec461297b3633ecb
parent4cef2fcda3adabcf6937170d9b869bf72a6d9dc6
brd: replace simple_strtol with kstrtoul in ramdisk_size

Replace simple_strtol() with the recommended kstrtoul() for parsing the
'ramdisk_size=' boot parameter. Unlike simple_strtol(), which returns a
long, kstrtoul() converts the string directly to an unsigned long and
avoids implicit casting.

Check the return value of kstrtoul() and reject invalid values. This
adds error handling while preserving behavior for existing values, and
removes use of the deprecated simple_strtol() helper. The current code
silently sets 'rd_size = 0' if parsing fails, instead of leaving the
default value (CONFIG_BLK_DEV_RAM_SIZE) unchanged.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/brd.c