From: Thorsten Blum <thorsten.blum@linux.dev>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fs: Replace simple_strtoul with kstrtoul in set_ihash_entries
Date: Thu, 18 Dec 2025 12:21:45 +0100 [thread overview]
Message-ID: <20251218112144.225301-2-thorsten.blum@linux.dev> (raw)
Replace simple_strtoul() with the recommended kstrtoul() for parsing the
'ihash_entries=' boot parameter.
Check the return value of kstrtoul() and reject invalid values. This
adds error handling while preserving behavior for existing valid values,
and removes use of the deprecated simple_strtoul() helper.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
fs/inode.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index 521383223d8a..a6df537eb856 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2531,10 +2531,7 @@ static void __wait_on_freeing_inode(struct inode *inode, bool is_inode_hash_lock
static __initdata unsigned long ihash_entries;
static int __init set_ihash_entries(char *str)
{
- if (!str)
- return 0;
- ihash_entries = simple_strtoul(str, &str, 0);
- return 1;
+ return kstrtoul(str, 0, &ihash_entries) == 0;
}
__setup("ihash_entries=", set_ihash_entries);
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
next reply other threads:[~2025-12-18 11:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-18 11:21 Thorsten Blum [this message]
2025-12-18 16:00 ` [PATCH] fs: Replace simple_strtoul with kstrtoul in set_ihash_entries Jan Kara
2025-12-24 12:36 ` Christian Brauner
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=20251218112144.225301-2-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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.