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

Configure Feed

Select the types of activity you want to include in your feed.

devtmpfs: Replace simple_strtoul with kstrtoint in mount_param

Replace simple_strtoul() with the recommended kstrtoint() for parsing
the 'devtmpfs.mount=' boot parameter. Unlike simple_strtoul(), which
returns an unsigned long, kstrtoint() converts the string directly to
int and avoids implicit casting.

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

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://patch.msgid.link/20251220125930.76836-2-thorsten.blum@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Thorsten Blum and committed by
Greg Kroah-Hartman
5f62af9f 99aa03f9

+1 -2
+1 -2
drivers/base/devtmpfs.c
··· 56 56 57 57 static int __init mount_param(char *str) 58 58 { 59 - mount_dev = simple_strtoul(str, NULL, 0); 60 - return 1; 59 + return kstrtoint(str, 0, &mount_dev) == 0; 61 60 } 62 61 __setup("devtmpfs.mount=", mount_param); 63 62