Re: [PATCH 5.10] overflow.h: use new generic division helpers to avoid / operator
From: Nick Desaulniers <hidden>
Date: 2021-09-14 19:51:00
Also in:
llvm
From: Nick Desaulniers <hidden>
Date: 2021-09-14 19:51:00
Also in:
llvm
On Tue, Sep 14, 2021 at 12:46 PM Linus Torvalds [off-list ref] wrote:
On Tue, Sep 14, 2021 at 12:10 PM Nick Desaulniers [off-list ref] wrote:quoted
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? -- Thanks, ~Nick Desaulniers