From: sashiko-bot@kernel.org
To: "Vít Kazík" <vitkazik@vitkazik.cz>,
miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com
Cc: tudor.ambarus@linaro.org, linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD
Date: Sat, 21 Nov 2026 23:56:10 +0000 [thread overview]
Message-ID: <sashiko-outbox-227519@kernel.org> (raw)
In-Reply-To: <20261121234125.16093-1-vitkazik@vitkazik.cz>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mtd: spinand: micron: divide-by-zero in
micron_4_ooblayout_ecc() when no ECC
--
commit 4c40aef0592463ef1027b9070b229cf841212d82
Author: Vít Kazík <vitkazik@vitkazik.cz>
mtd: spinand: micron: add support for MT29F1G01AAADD
This commit adds SPI NAND table support and an OOB layout definition for the
Micron MT29F1G01AAADD (M68A) flash chip.
> diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
> index 36f6cbbd7462c..cc6eff0e54c24 100644
> --- a/drivers/mtd/nand/spi/micron.c
> +++ b/drivers/mtd/nand/spi/micron.c
> @@ -134,6 +134,23 @@ static const struct mtd_ooblayout_ops micron_4_ooblayout = {
> .free = micron_4_ooblayout_free,
> };
>
> +static int micron_m68a_ooblayout_free(struct mtd_info *mtd, int section,
> + struct mtd_oob_region *region)
> +{
> + if (section >= 4)
> + return -ERANGE;
> +
> + region->offset = (section * 16) + 2;
> + region->length = 6;
> +
> + return 0;
> +}
> +
> +static const struct mtd_ooblayout_ops micron_m68a_ooblayout = {
> + .ecc = micron_4_ooblayout_ecc,
> + .free = micron_m68a_ooblayout_free,
> +};
[Severity: Medium]
Can wiring micron_4_ooblayout_ecc into micron_m68a_ooblayout cause a divide by
zero in micron_4_ooblayout_ecc() when the device is probed without an ECC
engine (such as with nand-no-ecc-engine in Device Tree)?
drivers/mtd/nand/spi/micron.c:micron_4_ooblayout_ecc() {
...
if (section >= spinand->base.memorg.pagesize /
mtd->ecc_step_size)
return -ERANGE;
...
}
When !nand->ecc.engine, spinand_init() still installs
spinand->eccinfo.ooblayout while leaving mtd->ecc_step_size at 0. During
spinand_probe(), mtd_device_register() -> add_mtd_device() ->
mtd_debugfs_populate() calls mtd_ooblayout_ecc(mtd, 0, ®ion), which invokes
micron_4_ooblayout_ecc() and divides by mtd->ecc_step_size.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121234125.16093-1-vitkazik@vitkazik.cz?part=1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2026-11-21 23:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 23:41 [PATCH] mtd: spinand: micron: add support for MT29F1G01AAADD Vít Kazík
2026-11-21 23:56 ` sashiko-bot [this message]
2026-11-22 0:26 ` Vít Kazík
2026-11-23 10:45 ` Marco Felsch
2026-11-23 12:35 ` Vít Kazík
2026-11-23 14:43 ` Miquel Raynal
-- strict thread matches above, loose matches on Subject: below --
2019-11-08 7:48 Marco Felsch
2019-08-14 8:22 Marco Felsch
2019-08-19 8:17 ` Miquel Raynal
2019-08-19 13:30 ` Marco Felsch
2019-08-19 14:34 ` Miquel Raynal
2019-08-20 6:39 ` Marco Felsch
2019-08-20 8:28 ` Uwe Kleine-König
2019-08-20 8:32 ` 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=sashiko-outbox-227519@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tudor.ambarus@linaro.org \
--cc=vigneshr@ti.com \
--cc=vitkazik@vitkazik.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox