Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Roman Vivchar" <rva333@protonmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH 3/3] nvmem: mtk-efuse: add mt6572 support
Date: Wed, 15 Jul 2026 14:45:59 +0000	[thread overview]
Message-ID: <20260715144559.8351F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715-6572-nvmem-v1-3-9c13be99d077@protonmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Incorrect string comparison logic erroneously matches any nvmem cell name that is a prefix of 'gpu-speedbin'.
--

--- Patch [3]: [PATCH 3/3] nvmem: mtk-efuse: add mt6572 support ---
commit 2c71c19eb8895343bae32ea1c4c07b25c01cd56c
Author: Roman Vivchar <rva333@protonmail.com>

    nvmem: mtk-efuse: add mt6572 support
    
    Add a platform data struct for the efuse controller.

> diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c
> index 1462f27608184..a794346084658 100644
> --- a/drivers/nvmem/mtk-efuse.c
> +++ b/drivers/nvmem/mtk-efuse.c
> @@ -124,6 +124,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 isn't a bug introduced by this patch, but there is a pre-existing issue
with the post-processing logic in this driver.

Looking at mtk_efuse_fixup_dt_cell_info(), the string comparison logic
erroneously matches any nvmem cell name that is a prefix of "gpu-speedbin":

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 strncmp() uses min(strlen(cell->name), strlen("gpu-speedbin")) for
the comparison length, it restricts the comparison to the shorter length.

If a device tree defines a cell with a name that is a substring of
"gpu-speedbin" (e.g., "gpu" or "gpu-speed") and has 3 or fewer bits, this
will evaluate to 0.

This incorrectly applies the post-processing fixup to completely unrelated
cells, which could cause silent data corruption.

Would it be possible to change this comparison to prevent short-prefix
matches?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715-6572-nvmem-v1-0-9c13be99d077@protonmail.com?part=3

      reply	other threads:[~2026-07-15 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 14:27 [PATCH 0/3] nvmem: mtk-efuse: mt6572 support Roman Vivchar via B4 Relay
2026-07-15 14:27 ` [PATCH 1/3] dt-bindings: nvmem: mediatek: efuse: add mt6572 Roman Vivchar via B4 Relay
2026-07-15 14:27 ` [PATCH 2/3] nvmem: mtk-efuse: add support for 32-bit aligned reads Roman Vivchar via B4 Relay
2026-07-15 14:27 ` [PATCH 3/3] nvmem: mtk-efuse: add mt6572 support Roman Vivchar via B4 Relay
2026-07-15 14:45   ` 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=20260715144559.8351F1F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox