From: Micha Ober <git@ober-mail.de>
To: linux-mtd@lists.infradead.org
Cc: miquel.raynal@bootlin.com, richard@nod.a, vigneshr@ti.com
Subject: [PATCH] mtd: spinand: micron: fix division by zero
Date: Sat, 28 Dec 2024 16:41:06 +0100 [thread overview]
Message-ID: <20241228154106.26995-1-git@ober-mail.de> (raw)
The `ecc_step_size` field ist not set at this point
in the call tree, leading to a division by zero.
Read the step size from the mtd device ecc config instead.
Signed-off-by: Micha Ober <git@ober-mail.de>
---
drivers/mtd/nand/spi/micron.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
index 12601bc4227a..7973996519d3 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -106,9 +106,10 @@ static int micron_4_ooblayout_free(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
struct spinand_device *spinand = mtd_to_spinand(mtd);
+ struct nand_device *nand = mtd_to_nanddev(mtd);
if (section >= spinand->base.memorg.pagesize /
- mtd->ecc_step_size)
+ nanddev_get_ecc_conf(nand)->step_size)
return -ERANGE;
if (section) {
--
2.39.5 (Apple Git-154)
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next reply other threads:[~2024-12-28 15:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-28 15:41 Micha Ober [this message]
2024-12-30 8:58 ` [PATCH] mtd: spinand: micron: fix division by zero Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241228154106.26995-1-git@ober-mail.de \
--to=git@ober-mail.de \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.a \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.