Re: [syzbot] [mtd?] divide error in block2mtd_setup2
From: Miquel Raynal
Date: Mon Aug 10 2026 - 08:47:11 EST
Hi Pei,
>> Best guess would be this:
>>
>> if ((long)size % erase_size) {
>>
>> Someone passing an erase_size of 0 would indeed trigger an exception.
>> Fix would be something like this:
>>
>> - if ((long)size % erase_size) {
>> + if (!erase_size || (long)size % erase_size) {
>>
>> I haven't touched the code is nearly two decades. If somebody else
>> feels like sending a patch and gathering all the glory, please be my
>> guest!
> Thank you for your contribution. I have sent this patch, but I forgot to
> add the Suggested-by: tag
You are invited to send a v2 with the said tag :)
Thanks,
Miquèl