[syzbot] [mtd?] divide error in block2mtd_setup2

Miquel Raynal miquel.raynal at bootlin.com
Mon Aug 10 05:40:28 PDT 2026


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



More information about the linux-mtd mailing list