* [PATCH] smbios: Guard invalid ofnode in smbios_scan_subnodes()
@ 2026-12-03 2:20 Dan Holmes-Mitra
2026-12-03 14:28 ` Raymond Mao
0 siblings, 1 reply; 2+ messages in thread
From: Dan Holmes-Mitra @ 2026-12-03 2:20 UTC (permalink / raw)
To: u-boot; +Cc: Raymond Mao, Tom Rini, Frank Böwingloh
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] smbios: Guard invalid ofnode in smbios_scan_subnodes()
2026-12-03 2:20 [PATCH] smbios: Guard invalid ofnode in smbios_scan_subnodes() Dan Holmes-Mitra
@ 2026-12-03 14:28 ` Raymond Mao
0 siblings, 0 replies; 2+ messages in thread
From: Raymond Mao @ 2026-12-03 14:28 UTC (permalink / raw)
To: Dan Holmes-Mitra; +Cc: u-boot, Tom Rini, Frank Böwingloh
Hi Dan,
On Wed, Dec 2, 2026 at 9:21 PM Dan Holmes-Mitra <dholmesm@google.com> wrote:
>
> 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(+)
>
Reviewed-by: Raymond Mao <raymondmaoca@gmail.com>
Thanks and Regards,
Raymond
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-03 14:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 2:20 [PATCH] smbios: Guard invalid ofnode in smbios_scan_subnodes() Dan Holmes-Mitra
2026-12-03 14:28 ` Raymond Mao
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.