mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
smbios: Do not fall back on devicetree without valid mapping
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: 83b28b55d7 ("smbios: add support for dynamic generation of Type 9 system slot tables")
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Raymond Mao <raymondmaoca@gmail.com>
This commit is contained in:
@@ -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 */
|
/* If the node is still missing, try with the mapping values */
|
||||||
nprop = convert_sysinfo_to_dt(ctx->subnode_name, prop);
|
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;
|
return val;
|
||||||
#endif
|
#endif
|
||||||
return val_def;
|
return val_def;
|
||||||
|
|||||||
Reference in New Issue
Block a user