From: sashiko-bot@kernel.org
To: "Miquel Raynal" <miquel.raynal@bootlin.com>,
"Pratyush Yadav" <pratyush@kernel.org>,
"Michael Walle" <mwalle@kernel.org>,
"Takahiro Kuwano" <takahiro.kuwano@infineon.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Alvin Zhou" <alvinzhou@mxic.com.tw>,
"Cheng Ming Lin" <chengminglin@mxic.com.tw>,
linux-mtd@lists.infradead.org
Subject: Re: [PATCH 4/4] mtd: spi-nor: macronix: Describe locking support for MX25L51245G
Date: Wed, 25 Nov 2026 18:25:55 +0000 [thread overview]
Message-ID: <sashiko-outbox-233986@kernel.org> (raw)
In-Reply-To: <20261125-macronix-upstreaming-spi-nor-cleanup-v1-4-0d1ab783fd8b@bootlin.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mtd: spi-nor: macronix: overlapping memcpy() in
mx25l51245_late_init()
--
commit 6981ddae179b4bc4f140785e21d8d0cec9e0f216
Author: Miquel Raynal <miquel.raynal@bootlin.com>
mtd: spi-nor: macronix: Describe locking support for MX25L51245G
This commit adds a late_init fixup for Macronix flash chips matching JEDEC
ID 0xc2201a to read the configuration register and enable block protection
locking if the OTP Top/Bottom bit is cleared.
> diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
> index bbc41af148826..87fdbd6c38009 100644
> --- a/drivers/mtd/spi-nor/macronix.c
> +++ b/drivers/mtd/spi-nor/macronix.c
[ ... ]
> @@ -86,6 +87,37 @@ macronix_qpp4b_post_sfdp_fixups(struct spi_nor *nor)
> return 0;
> }
>
> +static int
> +mx25l51245_late_init(struct spi_nor *nor)
> +{
> + struct spi_nor_flash_parameter *params = nor->params;
> +
> + /*
> + * Locking is optional, so leave locking disabled if the CR cannot be
> + * read (e.g. the controller does not support the 0x15 opcode).
> + */
> + if (spi_nor_read_sr2(nor, nor->bouncebuf))
> + return 0;
[Severity: Low]
Does passing nor->bouncebuf to spi_nor_read_sr2() cause an overlapping
memcpy()?
spi_nor_read_sr2() calls spi_nor_read_sr_ll(), which uses nor->bouncebuf
for the SPI transfer and then runs memcpy(sr, nor->bouncebuf, len) to copy
the result to the caller's buffer. Passing a stack u8 variable instead of
nor->bouncebuf avoids calling memcpy() with identical source and
destination pointers.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125-macronix-upstreaming-spi-nor-cleanup-v1-0-0d1ab783fd8b@bootlin.com?part=4
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
prev parent reply other threads:[~2026-11-25 18:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 18:01 [PATCH 0/4] mtd: spi-nor: macronix: Improve general support Miquel Raynal
2026-11-25 18:01 ` [PATCH 1/4] mtd: spi-nor: macronix: Clear the default RDCR opcode Miquel Raynal
2026-11-25 18:17 ` sashiko-bot
2026-11-25 18:01 ` [PATCH 2/4] mtd: spi-nor: macronix: Clear the RDCR opcode on MX25L3255E Miquel Raynal
2026-11-25 18:22 ` sashiko-bot
2026-11-25 18:01 ` [PATCH 3/4] mtd: spi-nor: macronix: Enable RDCR for the parts that support it Miquel Raynal
2026-11-25 18:01 ` [PATCH 4/4] mtd: spi-nor: macronix: Describe locking support for MX25L51245G Miquel Raynal
2026-11-25 18:25 ` sashiko-bot [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=sashiko-outbox-233986@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alvinzhou@mxic.com.tw \
--cc=chengminglin@mxic.com.tw \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=mwalle@kernel.org \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=sashiko-reviews@lists.linux.dev \
--cc=takahiro.kuwano@infineon.com \
--cc=thomas.petazzoni@bootlin.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