[PATCH] afs: Replace simple_strtoul with kstrtoul in afs_parse_address

Jeffrey E Altman jaltman at auristor.com
Fri May 30 05:43:00 PDT 2025


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4276 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/linux-afs/attachments/20250530/c980cbe6/attachment.p7s>


More information about the linux-afs mailing list