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 <felix-coreboot@felixheld.de>
Change-Id: Iccacc89bfc497449ad0716a3436949505b65f748
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76079
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c
index 71b9c62..089b42d 100644
--- a/src/soc/amd/common/block/acpi/ivrs.c
+++ b/src/soc/amd/common/block/acpi/ivrs.c
@@ -69,6 +69,7 @@
/* 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 @@
/* 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 @@
*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);