From: Dan Holmes-Mitra <dholmesm@google.com>
To: u-boot@lists.u-boot-project.org
Cc: "Raymond Mao" <raymondmaoca@gmail.com>,
"Tom Rini" <trini@konsulko.com>,
"Frank Böwingloh" <f.boewingloh@beckhoff.com>
Subject: [PATCH] smbios: Guard invalid ofnode in smbios_scan_subnodes()
Date: Thu, 03 Dec 2026 02:20:58 GMT [thread overview]
Message-ID: <20261203022028.03-00-dholmesm@google.com> (raw)
Return 0 early in smbios_scan_subnodes() when ctx->node is invalid
rather than passing an invalid ofnode to ofnode_first_subnode().
Signed-off-by: Dan Holmes-Mitra <dholmesm@google.com>
---
Mirrors commit 8327aa9af4 ("smbios: Do not look up children of invalid nodes").
Built cleanly with qemu_arm64_defconfig (CONFIG_GENERATE_SMBIOS_TABLE_VERBOSE=y)
and sandbox_defconfig.
Checked with scripts/checkpatch.pl --strict --u-boot (0 errors, 0 warnings).
lib/smbios.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/smbios.c b/lib/smbios.c
index afde6401ae..3ccd612f73 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -965,6 +965,9 @@ static int smbios_scan_subnodes(ulong *current, struct smbios_ctx *ctx,
int len = 0;
struct smbios_ctx ctx_bak;
+ if (!ofnode_valid(ctx->node))
+ return 0;
+
memcpy(&ctx_bak, ctx, sizeof(ctx_bak));
for (i = 0, child = ofnode_first_subnode(ctx->node);
base-commit: d1caced3a435607435cb7969e34499051a4ac1e6
--
2.56.1.911.g883d8bcb20-goog
next reply other threads:[~2026-12-03 5:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 2:20 Dan Holmes-Mitra [this message]
2026-12-03 14:28 ` [PATCH] smbios: Guard invalid ofnode in smbios_scan_subnodes() Raymond Mao
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=20261203022028.03-00-dholmesm@google.com \
--to=dholmesm@google.com \
--cc=f.boewingloh@beckhoff.com \
--cc=raymondmaoca@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.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