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

Miquel Raynal <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.drivers.mtd
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.