Re: [PATCH 1/2] btrfs: use min_t() for mismatched type comparison
From: Arnd Bergmann
Date: Tue Feb 25 2025 - 16:30:41 EST
On Tue, Feb 25, 2025, at 22:22, Qu Wenruo wrote:
> 在 2025/2/26 06:14, Arnd Bergmann 写道:
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>
>> loff_t is a signed type, so using min() to compare it against a u64
>> causes a compiler warning:
>>
>> fs/btrfs/extent_io.c:2497:13: error: call to '__compiletime_assert_728' declared with 'error' attribute: min(folio_pos(folio) + folio_size(folio) - 1, end) signedness error
>> 2497 | cur_end = min(folio_pos(folio) + folio_size(folio) - 1, end);
>> | ^
>>
>> Use min_t() instead.
>>
>> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202502211908.aCcQQyEY-lkp@xxxxxxxxx/
>> Fixes: aba063bf9336 ("btrfs: prepare extent_io.c for future larger folio support")
>> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> Thanks a lot, those fixes will be merged into the next version.
>
> For now the series is only for test purposes as there is a backlog of
> subpage block size related patches pending.
Ok, thanks! Please double-check that the calculation in
patch 2/2 is actually correct though, as I wasn't entirely
sure about that part.
Arnd