From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B5BF3D902E for ; Mon, 10 Aug 2026 12:40:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786365638; cv=none; b=A8Oedi8gJr14V67Kuk1n0VWrKjlwSU1Ss4Sbr2iY3Fm6Ef4P5nocuDLa8fJ886WXpdghWtihNWGE4/mcIEDe5rgrBGdj5/lFoEux3lv6vzeT1hWV9YnG7jovOk7zhMRbSX7Mh4VV9C2bKx3PkBLHnuax0NcMdOWAzF3IAuSrFXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786365638; c=relaxed/simple; bh=YfWkLyMyiOVg2LgDgK6KEwPQ8yui08rHwXhF6UGG+xs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=I4aKxoN9rwfQPjQlSMeg3318RrljYDJ1cxpMJahwvrazZvjb9ct+uak310BkKNlMwOFrSCcA1n6inrR7xZbPHV+3h4Z3SiTO4kG7PgseTBau1m0PIy3AF5VwoUjbWoAKHj2li0PP5esy2BYhQ/2dgVoGEN/Wq2wTEgvydG21zd8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=AXW2B5Wb; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="AXW2B5Wb" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 4F6BC4E41178; Mon, 10 Aug 2026 12:40:34 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 131BE6033B; Mon, 10 Aug 2026 12:40:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 781BE11C4A525; Mon, 10 Aug 2026 14:40:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1786365633; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=GVCufjwBFEQLygR4gzQm68S9YYyK6w05FacHTuX+iU8=; b=AXW2B5Wby41oU31q9hYPSlgVRWZSheAys6ZRoWFoMQfTCSnz76qH7hHfFNAAvw8YCwzCqZ e28hf51ASvLxeco7epFHk3h3ogsdHP82yTG7LZIpZKbxm5X64fnOC/fha1j3FWcBW4O54E B2joqctmZNdNX/IUI32ED89JBkopArVXNdVxMbTvJM403VxU0q/8EvGQTBHwoK4HYyM5he TTiFoyaIIZf5CQKEEQp+UoCRZJ0z/WFfuqWMG7aIj4k+UTOzi11XvKD8lD66Pc38hed/1Z +yea01Xq+idWWcnnRa/m4kCoWflabCivVetF97ayphAd5t7ICBN0HskZ6SLkCA== From: Miquel Raynal To: Pei Xiao Cc: =?utf-8?Q?J=C3=B6rn?= Engel , syzbot , joern@lazybastard.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, richard@nod.at, syzkaller-bugs@googlegroups.com, vigneshr@ti.com Subject: Re: [syzbot] [mtd?] divide error in block2mtd_setup2 In-Reply-To: <29397db9-7db4-4969-bb0e-5bb71f0c0303@kylinos.cn> (Pei Xiao's message of "Mon, 10 Aug 2026 17:17:50 +0800") References: <6a791c94.01d0871a.3a0d52.009b.GAE@google.com> <29397db9-7db4-4969-bb0e-5bb71f0c0303@kylinos.cn> User-Agent: mu4e 1.12.12; emacs 30.2 Date: Mon, 10 Aug 2026 14:40:28 +0200 Message-ID: <87se4mqhc3.fsf@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Hi Pei, >> Best guess would be this: >>=20 >> if ((long)size % erase_size) { >>=20 >> Someone passing an erase_size of 0 would indeed trigger an exception. >> Fix would be something like this: >>=20 >> - if ((long)size % erase_size) { >> + if (!erase_size || (long)size % erase_size) { >>=20 >> 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=C3=A8l