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

Pei Xiao <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.drivers.mtd
Message-ID <[email protected]>

在 2026/8/10 20:40, Miquel Raynal 写道:
> 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 :)
Thank you for your reply. I am waiting for a reply on whether the cast
on 'long' needs to be removed. Once that is confirmed, I would be happy
to do it. Thank you.

Pei.
> 
> 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.