From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 427FBC7EE23 for ; Mon, 22 May 2023 15:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233717AbjEVP6n (ORCPT ); Mon, 22 May 2023 11:58:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbjEVP6l (ORCPT ); Mon, 22 May 2023 11:58:41 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5FE8B5 for ; Mon, 22 May 2023 08:58:39 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 0BCA2240007; Mon, 22 May 2023 15:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684771118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lNO7ihmAZxKF90Y/XV+Q0lLC8kGDIEujfsZBJ+mXFHk=; b=dlJCMm21miORp2NPYFg4PRL/poVGsZi+hkpYbTXClU9/ZpSzNUIAC7Xmm2icgQWrZLmiMs 6/GyuZk9X8UjXRjMWZ3Fmgmmx5H4KzpTO1XwPCmx9dGeN5U2IolIAJye9uJzm8GcmscTSR v47NXFbeSRU8Mf8MxUD8dETcFjZuzBjbdBjBnBObEiemoKaE3zu/0wrxZQqeBK3NZhUt85 +6Rw3fA2nS5nf1W5J2pSAaNGaUKpnHVPb1YycdKNy1tJDN/yIpyGXTQmw9V34S5+OOrYjI 96J+T7bHVsLnAvZy3YQhzZTO5v4UjM3bfXHREXqhNwcu+Lo4wYqej71FPocJUQ== From: Miquel Raynal To: Tudor Ambarus , miquel.raynal@bootlin.com, richard@nod.at, todd.e.brandt@intel.com Cc: vigneshr@ti.com, pratyush@kernel.org, michael@walle.cc, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, regressions@leemhuis.info, bagasdotme@gmail.com, regressions@lists.linux.dev, joneslee@google.com, Todd Brandt Subject: Re: [PATCH] mtd: spi-nor: Fix divide by zero for spi-nor-generic flashes Date: Mon, 22 May 2023 17:58:35 +0200 Message-Id: <20230522155835.46756-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230518085440.2363676-1-tudor.ambarus@linaro.org> References: MIME-Version: 1.0 X-linux-mtd-patch-notification: thanks X-linux-mtd-patch-commit: b'da8291aa0ca6c789dcfab7bd2654b7faa3894956' Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2023-05-18 at 08:54:40 UTC, Tudor Ambarus wrote: > We failed to initialize n_banks for spi-nor-generic flashes, which > caused a devide by zero when computing the bank_size. > > By default we consider that all chips have a single bank. Initialize > the default number of banks for spi-nor-generic flashes. Even if the > bug is fixed with this simple initialization, check the n_banks value > before dividing so that we make sure this kind of bug won't occur again > if some other struct instance is created uninitialized. > > Suggested-by: Todd Brandt > Reported-by: Todd Brandt > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217448 > Fixes: 9d6c5d64f028 ("mtd: spi-nor: Introduce the concept of bank") > Link: https://lore.kernel.org/all/20230516225108.29194-1-todd.e.brandt@intel.com/ > Signed-off-by: Tudor Ambarus > Tested-by: Todd Brandt > Reviewed-by: Miquel Raynal Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks. Miquel