summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2023-06-23 19:03:57 +0200
committerFelix Held <felix-coreboot@felixheld.de>2023-06-26 12:03:22 +0000
commitfe242cea1e8af2cb88ddd935887f2c9096d76efc (patch)
tree3ff6717a25bda5ace1dfc338d29e3ae85b816436 /src/soc/amd/common
parent8cbafe8723bec983cab5e00db347551a27f74875 (diff)
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>
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r--src/soc/amd/common/block/acpi/ivrs.c3
1 files changed, 3 insertions, 0 deletions
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);