From: sashiko-bot@kernel.org
To: "Lee Jones" <lee@kernel.org>
Cc: linux-amlogic@lists.infradead.org, neil.armstrong@linaro.org
Subject: Re: [PATCH 09/10] nvmem: meson-efuse: Detect short reads and writes from Secure Monitor
Date: Thu, 03 Dec 2026 08:54:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-247398@kernel.org> (raw)
In-Reply-To: <320c7649745541c0954f2590db10bd186c3ccd75.1796286324.git.lee@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] nvmem: meson_efuse_read() exempts 0 return from short-read
detection
--
commit f954b4c965de299d7ba849b64117c5f529cb5207
Author: Lee Jones <lee@kernel.org>
nvmem: meson-efuse: Detect short reads and writes from Secure Monitor
This commit checks the byte count returned by meson_sm_call_read() and
meson_sm_call_write() in meson_efuse_read() and meson_efuse_write(),
returning -EIO on short transfers instead of silently returning 0.
> diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c
> index 029cad70a0af1..0482057219d22 100644
> --- a/drivers/nvmem/meson-efuse.c
> +++ b/drivers/nvmem/meson-efuse.c
> @@ -22,8 +22,12 @@ static int meson_efuse_read(void *context, unsigned int offset,
>
> ret = meson_sm_call_read(fw, (u8 *)val, bytes, SM_EFUSE_READ, offset,
> bytes, 0, 0, 0);
> + if (ret < 0)
> + return ret;
> + if (ret && ret != bytes)
> + return -EIO;
>
> - return ret < 0 ? ret : 0;
> + return 0;
> }
[Severity: Medium]
Should this check "if (ret != bytes)" directly instead of exempting ret == 0?
SM_EFUSE_READ returns the byte count on success; the 0-return fallback in
meson_sm_call_read() was added by 7a9bc330df9b ("firmware: meson-sm: Allow 0
as valid return value") for special commands like SM_GET_CHIP_ID that do not
report a length.
If Secure Monitor returns 0 for a non-zero SM_EFUSE_READ, meson_sm_call_read()
copies stale data from fw->sm_shmem_out_base into val and returns 0. With the
"ret &&" guard, meson_efuse_read() treats that 0-byte read as success and
returns stale shared memory to nvmem callers instead of -EIO.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796286324.git.lee@kernel.org?part=9
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-12-03 8:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 8:26 [PATCH 00/10] nvmem: Fix Critical and High issues reported by Sashiko Lee Jones
2026-12-03 8:26 ` Lee Jones
2026-12-03 8:26 ` [PATCH 01/10] nvmem: meson-efuse: Reject negative or zero SMC size in meson_efuse_probe() Lee Jones
2026-12-03 8:26 ` Lee Jones
2026-12-03 8:26 ` [PATCH 02/10] nvmem: core: Prevent integer underflow in nvmem_cell_attr_read() Lee Jones
2026-12-03 8:26 ` [PATCH 03/10] nvmem: sprd: Avoid out-of-bounds read on partial writes in sprd_efuse_raw_prog() Lee Jones
2026-12-04 1:27 ` Baolin Wang
2026-12-03 8:26 ` [PATCH 04/10] nvmem: core: Handle multi-byte bit offsets in nvmem_cell_prepare_write_buffer() Lee Jones
2026-12-03 8:26 ` [PATCH 05/10] nvmem: core: Serialise writes when toggling the write-protect GPIO Lee Jones
2026-12-03 8:26 ` [PATCH 06/10] nvmem: eeprom_93xx46: Reject unaligned writes on 16-bit devices Lee Jones
2026-12-03 8:26 ` [PATCH 07/10] nvmem: eeprom_93xx46: Hold device lock across erase/write enable sequences Lee Jones
2026-12-03 8:26 ` [PATCH 08/10] nvmem: eeprom_93xx46: Use DMA-safe command buffer for SPI transfers Lee Jones
2026-12-03 8:26 ` [PATCH 09/10] nvmem: meson-efuse: Detect short reads and writes from Secure Monitor Lee Jones
2026-12-03 8:26 ` Lee Jones
2026-12-03 8:54 ` sashiko-bot [this message]
2026-12-03 8:26 ` [PATCH 10/10] nvmem: stm32: Avoid OP-TEE session leak on unaligned writes Lee Jones
2026-12-03 10:16 ` Patrick DELAUNAY
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-247398@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=lee@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.