On Wed, Sep 14, 2022 at 04:55:51PM -0400, Mikulas Patocka wrote: > + /* make sure that "len << SECTOR_SHIFT" doesn't overflow */ > + if (max_sectors > UINT_MAX >> SECTOR_SHIFT) > + max_sectors = UINT_MAX >> SECTOR_SHIFT; This should use max / max_t: max_sectors = max(max_sectors, UINT_MAX >> SECTOR_SHIFT) & ~bs_mask;