Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Svyatoslav Ryhel" <clamor95@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 03/10] ARM: tegra: tf701t: Add MC and EMC timing nodes
Date: Fri, 31 Jul 2026 12:02:07 +0000	[thread overview]
Message-ID: <20260731120208.53B971F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260731114106.169398-4-clamor95@gmail.com>

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

Pre-existing issues:
- [Critical] The tegra114-emc driver causes a heap out-of-bounds write by calling tegra124_clk_set_emc_callbacks(), which incorrectly casts the Tegra114 "emc" GATE clock to a struct tegra_clk_emc.
--

--- Patch [3]: [PATCH v3 03/10] ARM: tegra: tf701t: Add MC and EMC timing nodes ---
commit 0da36cf6ac395d6c7a0f9761226778f6cf5ac2ed
Author: Svyatoslav Ryhel <clamor95@gmail.com>

ARM: tegra: tf701t: Add MC and EMC timing nodes

This commit configures the Memory Controllers for the ASUS TF701T by adding
the required EMC and MC timing nodes to the device tree.

> diff --git a/arch/arm/boot/dts/nvidia/tegra114-asus-tf701t.dts b/arch/arm/boot/dts/nvidia/tegra114-asus-tf701t.dts
> --- a/arch/arm/boot/dts/nvidia/tegra114-asus-tf701t.dts
> +++ b/arch/arm/boot/dts/nvidia/tegra114-asus-tf701t.dts
> @@ -1610,6 +1693,636 @@ i2c-thermtrip {
>  		};
>  	};
>  
> +	memory-controller@70019000 {
> +		emc-timings-0 {
> +			/* Mozart Rev B Hynix DDR3 792MHz */
> +			nvidia,ram-code = <0>;

[Severity: Critical]
This isn't a bug introduced by this patch, but it appears that enabling these
nodes causes the tegra114-emc driver to probe, which triggers a pre-existing
heap out-of-bounds write.

During probe, drivers/memory/tegra/tegra114-emc.c:tegra114_emc_probe() calls
tegra124_clk_set_emc_callbacks(). That function retrieves the "emc" clock and
blindly casts it to struct tegra_clk_emc to assign the callbacks:

drivers/clk/tegra/clk-tegra124-emc.c:tegra124_clk_set_emc_callbacks() {
    ...
    hw = __clk_get_hw(clk);
    tegra = container_of(hw, struct tegra_clk_emc, hw);

    tegra->prepare_timing_change = prep_cb;
    tegra->complete_timing_change = complete_cb;
    ...
}

However, on Tegra114, the "emc" clock is registered as a much smaller
struct tegra_clk_periph_gate, not a struct tegra_clk_emc:

drivers/clk/tegra/clk-tegra-periph.c:gate_clks() {
    ...
    GATE("emc", "emc_mux", 57, 0, tegra_clk_emc, CLK_IS_CRITICAL),
    ...
}

Writing to tegra->prepare_timing_change and tegra->complete_timing_change
overwrites adjacent memory past the end of the tegra_clk_periph_gate structure.

Should the clock registration in Tegra114 be updated to use tegra_clk_emc,
or does the EMC driver need a different way to handle callbacks on this
platform before these nodes are enabled?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260731114106.169398-1-clamor95@gmail.com?part=3

  reply	other threads:[~2026-07-31 12:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 11:40 [PATCH v3 00/10] ARM: tegra: tf701t: Add new features Svyatoslav Ryhel
2026-07-31 11:40 ` [PATCH v3 01/10] ARM: tegra: tf701t: Configure CPU DFLL clock node Svyatoslav Ryhel
2026-07-31 11:56   ` sashiko-bot
2026-07-31 11:40 ` [PATCH v3 02/10] ARM: tegra: tf701t: Add core-supply to PMC node Svyatoslav Ryhel
2026-07-31 11:40 ` [PATCH v3 03/10] ARM: tegra: tf701t: Add MC and EMC timing nodes Svyatoslav Ryhel
2026-07-31 12:02   ` sashiko-bot [this message]
2026-07-31 11:41 ` [PATCH v3 04/10] ARM: tegra: tf701t: Remove pin_ prefix from PMIC pinmux Svyatoslav Ryhel
2026-07-31 11:41 ` [PATCH v3 05/10] ARM: tegra: tf701t: Add thermal zones for nct1008 sensor Svyatoslav Ryhel
2026-07-31 11:41 ` [PATCH v3 06/10] ARM: tegra: tf701t: Tune MMC devices Svyatoslav Ryhel
2026-07-31 11:41 ` [PATCH v3 07/10] ARM: tegra: tf701t: Fix BCM43341 WiFi/BT chip configuration Svyatoslav Ryhel
2026-07-31 11:54   ` sashiko-bot
2026-07-31 11:41 ` [PATCH v3 08/10] ARM: tegra: tf701t: Complete power sensor node Svyatoslav Ryhel
2026-07-31 11:41 ` [PATCH v3 09/10] ARM: tegra: tf701t: Configure UART-B line used for GPS Svyatoslav Ryhel
2026-07-31 11:41 ` [PATCH v3 10/10] ARM: tegra: tf701t: Add chosen node Svyatoslav Ryhel

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=20260731120208.53B971F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox