From: Su Hui <suhui@nfschina.com>
To: Jeffrey E Altman <jaltman@auristor.com>,
dhowells@redhat.com, marc.dionne@auristor.com
Cc: linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] afs: Replace simple_strtoul with kstrtoul in afs_parse_address
Date: Sat, 31 May 2025 07:17:25 +0800 [thread overview]
Message-ID: <f4fcc669-25fc-47ee-9d7b-610be91d99ce@nfschina.com> (raw)
In-Reply-To: <f9f56006-8490-43cb-a622-6e95c3af1d24@auristor.com>
On 5/30/25 8:43 PM, Jeffrey E Altman wrote:
> On 5/30/2025 6:29 AM, Su Hui wrote:
>> On 5/30/25 7:35 AM, Jeffrey E Altman wrote:
>>>
>>> Do you see an overflow condition which would not be caught by those
>>> checks which would be caught by use of kstrtoul()?
>> Actually, no example in reality.
>> If p can equal to '0xffffffffffffffff0000000000000001',
>> simple_strtoul() and kstroul() all transform 'p' to unsigned long
>> value '0x1'.
>> But kstrtoul() return an error and we can know overflow happens. If
>> 'p' can be a very long string, kstroul() make sense.
>>
> The expected use case is for the input string not to exceed 3
> characters. The valid range is decimal 0 to 128. That could be
> enforced by switching to simple_strntoul() and relying upon the
> existing checks.
Got it, thanks for your reply and sorry for the noise.
Su Hui
next prev parent reply other threads:[~2025-05-30 23:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-27 8:49 [PATCH] afs: Replace simple_strtoul with kstrtoul in afs_parse_address Su Hui
2025-05-29 23:35 ` Jeffrey E Altman
2025-05-30 10:29 ` Su Hui
2025-05-30 12:43 ` Jeffrey E Altman
2025-05-30 23:17 ` Su Hui [this message]
2025-05-30 9:32 ` David Howells
2025-05-30 10:42 ` Su Hui
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=f4fcc669-25fc-47ee-9d7b-610be91d99ce@nfschina.com \
--to=suhui@nfschina.com \
--cc=dhowells@redhat.com \
--cc=jaltman@auristor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
/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