]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
acpi: Clear reserved bits in IORT
authorPatrick Rudolph <patrick.rudolph@9elements.com>
Sun, 16 Mar 2025 08:32:54 +0000 (09:32 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 3 Apr 2025 17:38:14 +0000 (11:38 -0600)
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 <patrick.rudolph@9elements.com>
lib/acpi/acpi_table.c

index 97cd8e8ddb05b68401133ede7225fdb63a6a5e88..fc43862ec37a310c7a6e3f496261196201f20341 100644 (file)
@@ -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;