On Tue, Sep 14, 2021 at 12:46 PM Linus Torvalds torvalds@linux-foundation.org wrote:
On Tue, Sep 14, 2021 at 12:10 PM Nick Desaulniers ndesaulniers@google.com wrote:
Isn't the parameter `blksize` of `nbd_set_size` declared as `loff_t`?
So?
I'm not seeing your point.
We've checked the range of it - in loff_t.
So the *value* is already checked, and most definitely fits in 'unsigned long'.
So __ffs() is perfectly fine. It will truncate that loff_t to a sane type.
What is the problem you're trying to solve?
Just making sure __ffs() works as expected should blksize > LONG_MAX on 32b targets. I don't see the range check you're referring to. loff_t is a long long, yeah?