All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Micha Ober <git@ober-mail.de>
Cc: linux-mtd@lists.infradead.org,  richard@nod.at,  vigneshr@ti.com
Subject: Re: [PATCH] mtd: spinand: micron: fix division by zero
Date: Mon, 30 Dec 2024 09:58:16 +0100	[thread overview]
Message-ID: <87ed1p8s47.fsf@bootlin.com> (raw)
In-Reply-To: <20241228154106.26995-1-git@ober-mail.de> (Micha Ober's message of "Sat, 28 Dec 2024 16:41:06 +0100")

Hi Micha,

Thanks for the patch, looks important.

Please fix Richard's address in next submission.

On 28/12/2024 at 16:41:06 +01, Micha Ober <git@ober-mail.de> wrote:

> The `ecc_step_size` field ist not set at this point

typo                          ^

> in the call tree, leading to a division by zero.

Definitely needs Fixes: + Cc: stable!

> Read the step size from the mtd device ecc config instead.

s/mtd device//
s/ecc config/ECC configuration/

>
> 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)

What about the exact same situation in the .ecc() hook?

>  {
>  	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) {

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2024-12-30  8:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-28 15:41 [PATCH] mtd: spinand: micron: fix division by zero Micha Ober
2024-12-30  8:58 ` Miquel Raynal [this message]

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=87ed1p8s47.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=git@ober-mail.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --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.