The IORT spec says that reserved bits must be set to zero, thus clear
all fields of the struct before starting to fill out non-reserved
fields.

Signed-off-by: Patrick Rudolph <[email protected]>
---
 lib/acpi/acpi_table.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c
index 97cd8e8ddb0..fc43862ec37 100644
--- a/lib/acpi/acpi_table.c
+++ b/lib/acpi/acpi_table.c
@@ -615,6 +615,7 @@ int acpi_iort_add_named_component(struct acpi_ctx *ctx,
        node->length += strlen(device_name) + 1;
 
        comp = (struct acpi_iort_named_component *)node->node_data;
+       memset(comp, '\0', sizeof(struct acpi_iort_named_component));
 
        comp->node_flags = node_flags;
        comp->memory_properties = memory_properties;
@@ -655,6 +656,8 @@ int acpi_iort_add_rc(struct acpi_ctx *ctx,
        node->length += sizeof(struct acpi_iort_id_mapping) * num_mappings;
 
        rc = (struct acpi_iort_rc *)node->node_data;
+       memset(rc, '\0', sizeof(struct acpi_iort_rc));
+
        rc->mem_access_properties = mem_access_properties;
        rc->ats_attributes = ats_attributes;
        rc->pci_segment_number = pci_segment_number;
@@ -713,6 +716,7 @@ int acpi_iort_add_smmu_v3(struct acpi_ctx *ctx,
        node->length += sizeof(struct acpi_iort_id_mapping) * num_mappings;
 
        smmu = (struct acpi_iort_smmu_v3 *)node->node_data;
+       memset(smmu, '\0', sizeof(struct acpi_iort_smmu_v3));
 
        smmu->base_address = base_address;
        smmu->flags = flags;
-- 
2.48.1

Reply via email to