mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@oss.nxp.com>
To: Stefan Ghetu <stefan.ghetu@nxp.com>
Cc: han.xu@nxp.com, miquel.raynal@bootlin.com, richard@nod.at,
	daniel.baluta@nxp.com, vigneshr@ti.com, imx@lists.linux.dev,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: rawnand: gpmi: Fix unintentional integer overflow
Date: Thu, 5 Nov 2026 11:30:34 -0600	[thread overview]
Message-ID: <auy9OtNE402TwdOi@SMW015318> (raw)
In-Reply-To: <20261105095935.159650-1-stefan.ghetu@nxp.com>

On Thu, Nov 05, 2026 at 11:59:35AM +0200, Stefan Ghetu wrote:
>
> From: Han Xu <han.xu@nxp.com>
>
> Cast block to loff_t before shifting, so that the shift is done in
> 64-bit arithmetic and the potential integer overflow is avoided.
> Reported by Coverity.
>
> Fixes: 10a2bcae9926 ("mtd: add the common code for GPMI-NAND controller driver")
> Signed-off-by: Han Xu <han.xu@nxp.com>
> Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 0f1528710a6a..e21e407f86c0 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -2236,7 +2236,7 @@ static int mx23_boot_init(struct gpmi_nand_data  *this)
>                  */
>                 chipnr = block >> (chip->chip_shift - chip->phys_erase_shift);
>                 page = block << (chip->phys_erase_shift - chip->page_shift);
> -               byte = block <<  chip->phys_erase_shift;
> +               byte = (loff_t)block <<  chip->phys_erase_shift;
>
>                 /* Send the command to read the conventional block mark. */
>                 nand_select_target(chip, chipnr);
> --
> 2.34.1
>
>

      reply	other threads:[~2026-11-05 17:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  9:59 Stefan Ghetu
2026-11-05 17:30 ` Frank Li [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=auy9OtNE402TwdOi@SMW015318 \
    --to=frank.li@oss.nxp.com \
    --cc=daniel.baluta@nxp.com \
    --cc=han.xu@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=stefan.ghetu@nxp.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®