summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <[email protected]>2026-05-09 22:31:36 +0200
committerTom Rini <[email protected]>2026-05-15 08:18:11 -0600
commit215496fec59b3fa09256b4fb62f92af46e2ec7f9 (patch)
treeae9689d8d61a671dec1cb4e5fe3c3b09aff40232
parentf3af40cff99528627c311aed939183e420c30885 (diff)
smbios: Do not fall back on devicetree without valid mappingHEADmaster
The smbios_get_val_si() function may get called for a sysinfo property for which there is no mapping to a devicetree property. Avoid a NULL pointer dereference in this case by skipping the read of the mapped property from the device tree. Fixes: 83b28b55d74f ("smbios: add support for dynamic generation of Type 9 system slot tables") Signed-off-by: Mark Kettenis <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Raymond Mao <[email protected]>
-rw-r--r--lib/smbios.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/smbios.c b/lib/smbios.c
index d5f18c8bd69..906d2753517 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -292,7 +292,7 @@ static int smbios_get_val_si(struct smbios_ctx * __maybe_unused ctx,
/* If the node is still missing, try with the mapping values */
nprop = convert_sysinfo_to_dt(ctx->subnode_name, prop);
- if (!ofnode_read_u32(ofnode_root(), nprop->dt_str, &val))
+ if (nprop && !ofnode_read_u32(ofnode_root(), nprop->dt_str, &val))
return val;
#endif
return val_def;