From fe242cea1e8af2cb88ddd935887f2c9096d76efc Mon Sep 17 00:00:00 2001 From: Felix Held Date: Fri, 23 Jun 2023 19:03:57 +0200 Subject: soc/amd/common/block/acpi/ivrs: zero-initialize ivhd_[range,entry] Zero-initialize the ivhd_range and ivhd_entry structs to make sure that the whole struct is in a defined state. Signed-off-by: Felix Held Change-Id: Iccacc89bfc497449ad0716a3436949505b65f748 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76079 Reviewed-by: Fred Reitberger Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/acpi/ivrs.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c index 71b9c626e3..089b42d01f 100644 --- a/src/soc/amd/common/block/acpi/ivrs.c +++ b/src/soc/amd/common/block/acpi/ivrs.c @@ -69,6 +69,7 @@ static unsigned long ivhd_dev_range(unsigned long current, uint16_t start_devid, /* 4-byte IVHD structures must be aligned to the 4-byte boundary. */ current = ALIGN_UP(current, 4); ivrs_ivhd_generic_t *ivhd_range = (ivrs_ivhd_generic_t *)current; + memset(ivhd_range, 0, sizeof(*ivhd_range)); /* Create the start range IVHD entry */ ivhd_range->type = IVHD_DEV_4_BYTE_START_RANGE; @@ -93,6 +94,7 @@ static unsigned long add_ivhd_dev_entry(struct device *parent, struct device *de /* 4-byte IVHD structures must be aligned to the 4-byte boundary. */ *current = ALIGN_UP(*current, 4); ivrs_ivhd_generic_t *ivhd_entry = (ivrs_ivhd_generic_t *)*current; + memset(ivhd_entry, 0, sizeof(*ivhd_entry)); ivhd_entry->type = type; ivhd_entry->dev_id = dev->path.pci.devfn | (dev->bus->secondary << 8); @@ -100,6 +102,7 @@ static unsigned long add_ivhd_dev_entry(struct device *parent, struct device *de *current += sizeof(ivrs_ivhd_generic_t); } else if (type == IVHD_DEV_8_BYTE_ALIAS_SELECT) { ivrs_ivhd_alias_t *ivhd_entry = (ivrs_ivhd_alias_t *)*current; + memset(ivhd_entry, 0, sizeof(*ivhd_entry)); ivhd_entry->type = type; ivhd_entry->dev_id = dev->path.pci.devfn | (dev->bus->secondary << 8); -- cgit v1.2.3