Re: [PATCH 1/2] lib/strtox: introduce kstrtoull_suffix() helper
From: Qu Wenruo
Date: Wed Dec 20 2023 - 05:01:50 EST
On 2023/12/20 20:24, Alexey Dobriyan wrote:
Just as mentioned in the comment of memparse(), the simple_stroull()
usage can lead to overflow all by itself.
which is the root cause...
I don't like one char suffixes. They are easy to integrate but then the
_real_ suffixes are "MiB", "GiB", etc.
If you care only about memparse(), then using _parse_integer() can be
arranged. I don't see why not.
Well, personally speaking I don't think we should even support the
suffix at all, at least for the only two usage inside btrfs.
But unfortunately I'm not the one to do the final call, and the final
call is to keep the suffix behavior...
And indeed using _parse_integer() with _parse_interger_fixup_radix()
would be better, as we don't need to extend the _kstrtoull() code base.
Thanks,
Qu
Attachment:
OpenPGP_0xC23D91F3A125FEA8.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature