From: sashiko-bot@kernel.org
To: "Roman Vivchar" <rva333@protonmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 3/3] nvmem: mtk-efuse: add mt6572 support
Date: Wed, 09 Sep 2026 11:28:41 +0000 [thread overview]
Message-ID: <20260909112841.A0A241F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260909-6572-nvmem-v3-3-c0c441656431@protonmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Flawed string comparison logic in `mtk_efuse_fixup_dt_cell_info` allows unintentional prefix matching.
--
commit a7b90ac028ac0c3f0279ff49927a48455c13bc74
Author: Roman Vivchar <rva333@protonmail.com>
nvmem: mtk-efuse: add mt6572 support
This commit adds a platform data struct for the efuse controller to support
the MediaTek MT6572 SoC, configuring read alignment and post-processing
behavior.
> diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c
> index 178b9d85f813e..99d061eef6e33 100644
> --- a/drivers/nvmem/mtk-efuse.c
> +++ b/drivers/nvmem/mtk-efuse.c
> @@ -132,6 +132,11 @@ static int mtk_efuse_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static const struct mtk_efuse_pdata mtk_mt6572_efuse_pdata = {
> + .uses_post_processing = false,
[Severity: High]
This is a pre-existing issue, but while reviewing the post-processing logic
controlled by this flag, I noticed a potential flaw in how cell names are
matched.
In mtk_efuse_fixup_dt_cell_info(), the string comparison allows shorter strings
to falsely match as a prefix:
drivers/nvmem/mtk-efuse.c:mtk_efuse_fixup_dt_cell_info() {
...
if (cell->nbits <= 3 &&
strncmp(cell->name, "gpu-speedbin", min(sz, strlen("gpu-speedbin"))) == 0)
cell->read_post_process = mtk_efuse_gpu_speedbin_pp;
...
}
Because it uses min(sz, strlen("gpu-speedbin")), wouldn't this incorrectly
apply GPU speedbin post-processing to any NVMEM cell whose name is merely a
prefix of "gpu-speedbin" (e.g., "gpu" or "gp") as long as it has nbits <= 3?
Could this lead to unintended data corruption by incorrectly modifying the
hardware read value for those unrelated NVMEM cells?
> + .needs_aligned_read = true,
> +};
> +
> static const struct mtk_efuse_pdata mtk_mt8186_efuse_pdata = {
> .uses_post_processing = true,
> .needs_aligned_read = false,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260909-6572-nvmem-v3-0-c0c441656431@protonmail.com?part=3
next prev parent reply other threads:[~2026-09-09 11:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 10:48 [PATCH v3 0/3] nvmem: mtk-efuse: mt6572 support Roman Vivchar via B4 Relay
2026-09-09 10:48 ` Roman Vivchar
2026-09-09 10:48 ` [PATCH v3 1/3] dt-bindings: nvmem: mediatek: efuse: add mt6572 Roman Vivchar via B4 Relay
2026-09-09 10:48 ` Roman Vivchar
2026-09-09 10:48 ` [PATCH v3 2/3] nvmem: mtk-efuse: add support for 32-bit aligned reads Roman Vivchar via B4 Relay
2026-09-09 10:48 ` Roman Vivchar
2026-09-09 10:48 ` [PATCH v3 3/3] nvmem: mtk-efuse: add mt6572 support Roman Vivchar via B4 Relay
2026-09-09 10:48 ` Roman Vivchar
2026-09-09 11:28 ` sashiko-bot [this message]
2026-09-09 12:09 ` [PATCH v3 0/3] nvmem: mtk-efuse: " AngeloGioacchino Del Regno
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=20260909112841.A0A241F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rva333@protonmail.com \
--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.