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

Jörn Engel <[email protected]>
Newsgroups org.infradead.lists.linux-mtd,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Sun, Aug 09, 2026 at 05:34:28PM -0700, syzbot wrote:
> 
> * 2a:	f7 f6                	div    %esi <-- trapping instruction

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!

Jörn

--
Those who come seeking peace without a treaty are plotting.
-- Sun Tzu

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
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.