From 08601b29aa44c51e35bb8f30596d667c008f6d66 Mon Sep 17 00:00:00 2001 From: Naresh Solanki Date: Wed, 31 May 2023 17:13:03 +0200 Subject: soc/amd/block/ivrs: Add NULL check for IVRS Add NULL check for ivrs pointer before use. Signed-off-by: Naresh Solanki Change-Id: Ibeb0ea3bcaa3512a93500588ad4f11046edee61f Reviewed-on: https://review.coreboot.org/c/coreboot/+/75506 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai Reviewed-by: Lean Sheng Tan --- src/soc/amd/common/block/acpi/ivrs.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/soc') diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c index 089b42d01f..ca58c35d8e 100644 --- a/src/soc/amd/common/block/acpi/ivrs.c +++ b/src/soc/amd/common/block/acpi/ivrs.c @@ -310,6 +310,11 @@ unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current) struct device *nb_dev; struct device *dev = NULL; + if (ivrs == NULL) { + printk(BIOS_WARNING, "%s: ivrs is NULL\n", __func__); + return current; + } + ivhd = &ivrs->ivhd; while ((dev = dev_find_path(dev, DEVICE_PATH_DOMAIN)) != NULL) { -- cgit v1.2.3