From: sashiko-bot@kernel.org
To: "Geert Uytterhoeven" <geert+renesas@glider.be>
Cc: linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 2/2] drm/tegra: Make sure clk_init_data is fully initialized
Date: Fri, 21 Aug 2026 10:13:46 +0000 [thread overview]
Message-ID: <20260821101347.1D3C11F000E9@smtp.kernel.org> (raw)
In-Reply-To: <9bc5029f7ad84b0b1e02be231a5abd7e5fa03946.1787239944.git.geert+renesas@glider.be>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing bounds check on the `nvidia,interface` device tree property causes out-of-bounds array indexing and arbitrary MMIO access.
--
--- Patch [2]: [PATCH 2/2] drm/tegra: Make sure clk_init_data is fully initialized ---
commit d6e18a3c09cc145658765914a32b191ad5da6aa8
Author: Geert Uytterhoeven <geert+renesas@glider.be>
drm/tegra: Make sure clk_init_data is fully initialized
The clk_init_data structure contains several mutually-exclusive members
for different methods to specify the possible parents of a clock,
prompting drivers to initialize only the members they need. However,
not initializing all members may cause subtle issues, which are only
exposed when CONFIG_INIT_STACK_ALL_PATTERN or CONFIG_INIT_STACK_NONE is
enabled. Make sure all members are fully initialized, to avoid such bugs,
and to prevent future breakage when converting drivers to a different
method for specifying the parents.
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 802d2db7007af..c28557d0c96e5 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -596,8 +596,8 @@ static const struct clk_ops tegra_clk_sor_pad_ops = {
> static struct clk *tegra_clk_sor_pad_register(struct tegra_sor *sor,
> const char *name)
> {
> + struct clk_init_data init = {};
> struct tegra_clk_sor_pad *pad;
> - struct clk_init_data init;
> struct clk *clk;
>
> pad = devm_kzalloc(sor->dev, sizeof(*pad), GFP_KERNEL);
[ ... ]
> pad->sor = sor;
>
> init.name = name;
> init.flags = 0;
> init.parent_names = tegra_clk_sor_pad_parents[sor->index];
[Severity: High]
This is a pre-existing issue, but can this out-of-bounds array indexing
occur if the Device Tree provides an invalid "nvidia,interface" value?
In tegra_sor_parse_dt(), the "nvidia,interface" property is read and
assigned directly to sor->index without any bounds checking:
drivers/gpu/drm/tegra/sor.c:tegra_sor_parse_dt() {
...
err = of_property_read_u32(np, "nvidia,interface", &value);
if (err < 0)
return err;
sor->index = value;
...
}
If a malformed Device Tree is provided, does using this unbounded sor->index to
access the tegra_clk_sor_pad_parents array lead to an out-of-bounds memory read?
It appears it could also cause arbitrary MMIO reads and writes when computing
register offsets using DC_DISP_CORE_SOR_SET_CONTROL(sor->index).
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1787239944.git.geert+renesas@glider.be?part=2
prev parent reply other threads:[~2026-08-21 10:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 10:03 [PATCH 0/2] drm: Make sure clk_init_data is fully initialized Geert Uytterhoeven
2026-08-21 10:03 ` [PATCH 1/2] drm/sun4i: " Geert Uytterhoeven
2026-08-21 10:13 ` sashiko-bot
2026-08-21 13:41 ` Chen-Yu Tsai
2026-08-21 10:03 ` [PATCH 2/2] drm/tegra: " Geert Uytterhoeven
2026-08-21 10:13 ` 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=20260821101347.1D3C11F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert+renesas@glider.be \
--cc=linux-clk@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--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.