mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: Jan Kara <jack@suse.cz>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] namespace: Replace simple_strtoul with kstrtoul to parse boot params
Date: Mon, 15 Dec 2025 15:17:14 +0100	[thread overview]
Message-ID: <E07BDF4C-F76A-4050-A4B9-3D2A362A3ABE@linux.dev> (raw)
In-Reply-To: <3hnvigpwa2jomy6wimsdkkz4da64x7nsk4ffoko47ocpokqbou@fqymwie5damt>

On 15. Dec 2025, at 10:15, Jan Kara wrote:
> On Sun 14-12-25 16:31:42, Thorsten Blum wrote:
>> Replace simple_strtoul() with the recommended kstrtoul() for parsing the
>> 'mhash_entries=' and 'mphash_entries=' boot parameters.
>> 
>> 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_strtoul() helper.
>> 
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> 
> ...
> 
>> @@ -49,20 +49,14 @@ static unsigned int mp_hash_shift __ro_after_init;
>> static __initdata unsigned long mhash_entries;
>> static int __init set_mhash_entries(char *str)
>> {
>> -	if (!str)
>> -		return 0;
>> -	mhash_entries = simple_strtoul(str, &str, 0);
>> -	return 1;
>> +	return kstrtoul(str, 0, &mhash_entries) == 0;
>> }
>> __setup("mhash_entries=", set_mhash_entries);
> 
> I'm not very experienced with the cmdline option parsing but AFAICT the
> 'str' argument can be indeed NULL and kstrtoul() will not be happy with
> that?

I don't think 'str' can be NULL. If you don't pass a value, 'str' will
be the empty string (just tested this).

Thanks,
Thorsten


  reply	other threads:[~2025-12-15 14:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-14 15:31 Thorsten Blum
2025-12-15  9:15 ` Jan Kara
2025-12-15 14:17   ` Thorsten Blum [this message]
2025-12-16  8:41     ` Jan Kara
2025-12-24 12:51 ` 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=E07BDF4C-F76A-4050-A4B9-3D2A362A3ABE@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®