Re: [syzbot] [mtd?] divide error in block2mtd_setup2

From: Pei Xiao

Date: Mon Aug 10 2026 - 21:22:17 EST




在 2026/8/11 00:27, Jörn Engel 写道:
> On Sun, Aug 09, 2026 at 07:03:22PM -0700, Jörn Engel wrote:
>>
>> Best guess would be this:
>>
>> if ((long)size % erase_size) {
>
> While at it, what purpose does the cast to (long) serve?
>
> As far as I can see, it is useless and should be removed. Fabian, do
> you remember why it was necessary?
The type of size is loff_t (i.e., long long, which is always 64-bit).
Casting it to (long)size on a 32-bit system would truncate it to a
32-bit long, so it seems this long cast needs to be removed.
It's been 12 years.. I wonder if the author still remembers.

Pei.
>
> Jörn
>
> --
> The real voyage of discovery consists not in seeking new landscapes,
> but in having new eyes.
> -- Marcel Proust
>