From: Thorsten Blum <thorsten.blum@linux.dev>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>
Cc: Thorsten Blum <thorsten.blum@linux.dev>, linux-kernel@vger.kernel.org
Subject: [PATCH] devtmpfs: Replace simple_strtoul with kstrtoint in mount_param
Date: Sat, 20 Dec 2025 13:59:31 +0100 [thread overview]
Message-ID: <20251220125930.76836-2-thorsten.blum@linux.dev> (raw)
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>
---
drivers/base/devtmpfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 194b44075ac7..3f7d724ef242 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -56,8 +56,7 @@ static struct req {
static int __init mount_param(char *str)
{
- mount_dev = simple_strtoul(str, NULL, 0);
- return 1;
+ return kstrtoint(str, 0, &mount_dev) == 0;
}
__setup("devtmpfs.mount=", mount_param);
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
reply other threads:[~2025-12-20 13:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251220125930.76836-2-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=dakr@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.