From: Thierry Reding <thierry.reding@kernel.org>
To: Jinhui Guo <guojinhui.liam@bytedance.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
Kartik Rajput <kkartik@nvidia.com>
Subject: Re: [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs
Date: Wed, 5 Aug 2026 09:40:03 +0200 [thread overview]
Message-ID: <anLnFvF8slRICc6R@orome> (raw)
In-Reply-To: <20260804121910.4961-2-guojinhui.liam@bytedance.com>
[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]
On Tue, Aug 04, 2026 at 08:19:09PM +0800, Jinhui Guo wrote:
> When booting without a FUSE device tree node, tegra_init_fuse() falls
> back to legacy SoC detection on 32-bit ARM systems. If the detected chip
> ID does not match any supported SoC, the default case only prints a
> warning and breaks out of the switch statement.
>
> In that case fuse->soc remains NULL, but initialization continues and
> later calls fuse->soc->init(fuse), which results in a NULL pointer
> dereference.
>
> Return -ENODEV from the default case to stop initialization immediately
> when the legacy fallback detects an unsupported SoC.
>
> Fixes: 7e939de1b2bb ("soc/tegra: fuse: Unify Tegra20 and Tegra30 drivers")
> Signed-off-by: Jinhui Guo <guojinhui.liam@bytedance.com>
> ---
> drivers/soc/tegra/fuse/fuse-tegra.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
The likelihood of this happening is pretty much zero. The only way that
you could potentially trigger it is by intentionally booting the system
with an entirely wrong DTB. Like if you booted a Tegra DTB on an Exynos
system or something. In that case it's likely that things will go side-
ways much earlier than this and you kind of deserve the crash from the
fuse->soc being NULL.
As such this is kind of a feature that prevents the boot from continuing
even though it doesn't stand a chance.
Then again, I suspect some AI or static analyzer flagged that we might
run into a NULL dereference, so if I don't take this, someone else is
just going to send a similar patch at some point.
Maybe a good compromise would be to turn the pr_warn() into a BUG() to
keep the system from booting and make it obvious to analyzers that we're
not intending to proceed in this case.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-08-05 7:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 12:19 [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Jinhui Guo
2026-08-04 12:19 ` [PATCH 1/2] soc/tegra: fuse: Return -ENODEV for unsupported legacy SoCs Jinhui Guo
2026-08-05 7:40 ` Thierry Reding [this message]
2026-08-04 12:19 ` [PATCH 2/2] soc/tegra: fuse: Add missing newline to APBMISC error message Jinhui Guo
2026-08-05 7:47 ` (subset) [PATCH 0/2] soc/tegra: fuse: Fix unsupported SoC init path and log formatting Thierry Reding
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=anLnFvF8slRICc6R@orome \
--to=thierry.reding@kernel.org \
--cc=guojinhui.liam@bytedance.com \
--cc=jonathanh@nvidia.com \
--cc=kkartik@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
/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