From: sashiko-bot@kernel.org
To: "Manikandan Muralidharan" <manikandan.m@microchip.com>,
pratyush@kernel.org, mwalle@kernel.org,
takahiro.kuwano@infineon.com, miquel.raynal@bootlin.com,
richard@nod.at, vigneshr@ti.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, srini@kernel.org,
nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com,
claudiu.beznea@tuxon.dev, linux@armlinux.org.uk,
richardcochran@gmail.com, arnd@arndb.de, linusw@kernel.org,
aaro.koskinen@iki.fi, enelsonmoore@gmail.com,
pengpeng@iscas.ac.cn, mathieu.dubois-briand@bootlin.com,
gregkh@linuxfoundation.org, michael@walle.cc,
linux-mtd@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v11 5/8] nvmem: layouts: add Microchip/SST SFDP EUI layout driver
Date: Tue, 01 Dec 2026 07:40:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-242788@kernel.org> (raw)
In-Reply-To: <784cd836a85d777f6e43653cda6524411cf78963.1796023049.git.manikandan.m@microchip.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] nvmem: layouts: missing table length check in
sfdp_eui_find_vendor_table()
--
commit 7782104c607bf7262ccb9481e36c42721570ab22
Author: Manikandan Muralidharan <manikandan.m@microchip.com>
nvmem: layouts: add Microchip/SST SFDP EUI layout driver
This commit adds an NVMEM layout driver that locates the Microchip/SST
vendor SFDP parameter table at runtime and exposes its factory-programmed
EUI-48 identifier as a "mac-address" NVMEM cell.
> diff --git a/drivers/nvmem/layouts/sst26vf-sfdp-eui.c b/drivers/nvmem/layouts/sst26vf-sfdp-eui.c
> new file mode 100644
> index 0000000000000..c4fdda35b64c1
> --- /dev/null
> +++ b/drivers/nvmem/layouts/sst26vf-sfdp-eui.c
> @@ -0,0 +1,158 @@
[ ... ]
> +static int sfdp_eui_find_vendor_table(struct nvmem_device *nvmem, u32 *ptp)
> +{
> + struct sfdp_parameter_header ph;
> + struct sfdp_header hdr;
> + int nph, i, ret;
> +
> + ret = nvmem_device_read(nvmem, 0, sizeof(hdr), &hdr);
> + if (ret < 0)
> + return ret;
> +
> + if (get_unaligned_le32(hdr.signature) != SFDP_SIGNATURE)
> + return -EINVAL;
> +
> + nph = hdr.nph + 1;
> +
> + for (i = 0; i < nph; i++) {
> + ret = nvmem_device_read(nvmem, sizeof(hdr) + i * sizeof(ph),
> + sizeof(ph), &ph);
> + if (ret < 0)
> + return ret;
> +
> + if (SFDP_PARAM_HEADER_ID(&ph) != SFDP_MCHP_VENDOR_ID)
> + continue;
> +
> + *ptp = SFDP_PARAM_HEADER_PTP(&ph);
> + return 0;
> + }
> +
> + return -ENOENT;
> +}
[Severity: Medium]
Should sfdp_eui_find_vendor_table() check that the vendor table length
(ph.length * 4) is at least SFDP_MCHP_EUI48_OFFSET + ETH_ALEN?
Standard non-EUI SST26VF064B flashes have a 0x01bf vendor parameter table
with ph.length = 0x18 DWORDs (0x60 bytes), as seen in the sst26vf064b SFDP
dump in Documentation/driver-api/mtd/spi-nor.rst. Without a length check,
sfdp_eui_add_cells() reads base + SFDP_MCHP_EUI48_MARKER_OFFSET (0x60) past
the end of the table, causing nvmem_device_read() to fail with -EINVAL
(or read unrelated trailing SFDP data if another table follows) instead of
returning 0 when no EUI-48 is present.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796023049.git.manikandan.m@microchip.com?part=5
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Manikandan Muralidharan" <manikandan.m@microchip.com>,
pratyush@kernel.org, mwalle@kernel.org,
takahiro.kuwano@infineon.com, miquel.raynal@bootlin.com,
richard@nod.at, vigneshr@ti.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, srini@kernel.org,
nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com,
claudiu.beznea@tuxon.dev, linux@armlinux.org.uk,
richardcochran@gmail.com, arnd@arndb.de, linusw@kernel.org,
aaro.koskinen@iki.fi, enelsonmoore@gmail.com,
pengpeng@iscas.ac.cn, mathieu.dubois-briand@bootlin.com,
gregkh@linuxfoundation.org, michael@walle.cc,
linux-mtd@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v11 5/8] nvmem: layouts: add Microchip/SST SFDP EUI layout driver
Date: Tue, 01 Dec 2026 07:40:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-242788@kernel.org> (raw)
In-Reply-To: <784cd836a85d777f6e43653cda6524411cf78963.1796023049.git.manikandan.m@microchip.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] nvmem: layouts: missing table length check in
sfdp_eui_find_vendor_table()
--
commit 7782104c607bf7262ccb9481e36c42721570ab22
Author: Manikandan Muralidharan <manikandan.m@microchip.com>
nvmem: layouts: add Microchip/SST SFDP EUI layout driver
This commit adds an NVMEM layout driver that locates the Microchip/SST
vendor SFDP parameter table at runtime and exposes its factory-programmed
EUI-48 identifier as a "mac-address" NVMEM cell.
> diff --git a/drivers/nvmem/layouts/sst26vf-sfdp-eui.c b/drivers/nvmem/layouts/sst26vf-sfdp-eui.c
> new file mode 100644
> index 0000000000000..c4fdda35b64c1
> --- /dev/null
> +++ b/drivers/nvmem/layouts/sst26vf-sfdp-eui.c
> @@ -0,0 +1,158 @@
[ ... ]
> +static int sfdp_eui_find_vendor_table(struct nvmem_device *nvmem, u32 *ptp)
> +{
> + struct sfdp_parameter_header ph;
> + struct sfdp_header hdr;
> + int nph, i, ret;
> +
> + ret = nvmem_device_read(nvmem, 0, sizeof(hdr), &hdr);
> + if (ret < 0)
> + return ret;
> +
> + if (get_unaligned_le32(hdr.signature) != SFDP_SIGNATURE)
> + return -EINVAL;
> +
> + nph = hdr.nph + 1;
> +
> + for (i = 0; i < nph; i++) {
> + ret = nvmem_device_read(nvmem, sizeof(hdr) + i * sizeof(ph),
> + sizeof(ph), &ph);
> + if (ret < 0)
> + return ret;
> +
> + if (SFDP_PARAM_HEADER_ID(&ph) != SFDP_MCHP_VENDOR_ID)
> + continue;
> +
> + *ptp = SFDP_PARAM_HEADER_PTP(&ph);
> + return 0;
> + }
> +
> + return -ENOENT;
> +}
[Severity: Medium]
Should sfdp_eui_find_vendor_table() check that the vendor table length
(ph.length * 4) is at least SFDP_MCHP_EUI48_OFFSET + ETH_ALEN?
Standard non-EUI SST26VF064B flashes have a 0x01bf vendor parameter table
with ph.length = 0x18 DWORDs (0x60 bytes), as seen in the sst26vf064b SFDP
dump in Documentation/driver-api/mtd/spi-nor.rst. Without a length check,
sfdp_eui_add_cells() reads base + SFDP_MCHP_EUI48_MARKER_OFFSET (0x60) past
the end of the table, causing nvmem_device_read() to fail with -EINVAL
(or read unrelated trailing SFDP data if another table follows) instead of
returning 0 when no EUI-48 is present.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796023049.git.manikandan.m@microchip.com?part=5
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2026-12-01 7:40 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 7:37 [PATCH v11 0/8] Read MAC address from SST vendor specific SFDP region Manikandan Muralidharan
2026-11-30 7:37 ` Manikandan Muralidharan
2026-11-30 7:37 ` [PATCH v11 1/8] dt-bindings: mtd: jedec,spi-nor: allow the SFDP to be exposed via NVMEM Manikandan Muralidharan
2026-11-30 7:37 ` Manikandan Muralidharan
2026-11-30 7:37 ` [PATCH v11 2/8] dt-bindings: nvmem: layouts: add Microchip/SST SFDP EUI layout Manikandan Muralidharan
2026-11-30 7:37 ` Manikandan Muralidharan
2026-11-30 7:37 ` [PATCH v11 3/8] nvmem: core: take a reference on dev.of_node in nvmem_register() Manikandan Muralidharan
2026-11-30 7:37 ` Manikandan Muralidharan
2026-11-30 7:37 ` [PATCH v11 4/8] mtd: spi-nor: sfdp: expose the SFDP as a read-only NVMEM device Manikandan Muralidharan
2026-11-30 7:37 ` Manikandan Muralidharan
2026-12-01 7:40 ` sashiko-bot
2026-12-01 7:40 ` sashiko-bot
2026-11-30 7:37 ` [PATCH v11 5/8] nvmem: layouts: add Microchip/SST SFDP EUI layout driver Manikandan Muralidharan
2026-11-30 7:37 ` Manikandan Muralidharan
2026-12-01 7:40 ` sashiko-bot [this message]
2026-12-01 7:40 ` sashiko-bot
2026-11-30 7:37 ` [PATCH v11 6/8] ARM: dts: microchip: sama5d27_wlsom1: use fixed-partitions for QSPI flash Manikandan Muralidharan
2026-11-30 7:37 ` Manikandan Muralidharan
2026-11-30 7:37 ` [PATCH v11 7/8] ARM: dts: microchip: sama5d27_wlsom1: read MAC address from QSPI SFDP Manikandan Muralidharan
2026-11-30 7:37 ` Manikandan Muralidharan
2026-11-30 7:37 ` [PATCH v11 8/8] ARM: configs: sama5: enable Microchip/SST SFDP EUI NVMEM layout Manikandan Muralidharan
2026-11-30 7:37 ` Manikandan Muralidharan
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-242788@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aaro.koskinen@iki.fi \
--cc=alexandre.belloni@bootlin.com \
--cc=arnd@arndb.de \
--cc=claudiu.beznea@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=enelsonmoore@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=krzk+dt@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=manikandan.m@microchip.com \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=michael@walle.cc \
--cc=miquel.raynal@bootlin.com \
--cc=mwalle@kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pengpeng@iscas.ac.cn \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=srini@kernel.org \
--cc=takahiro.kuwano@infineon.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 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.