U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Rudolph <patrick.rudolph@9elements.com>
To: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>
Cc: Patrick Rudolph <patrick.rudolph@9elements.com>, u-boot@lists.denx.de
Subject: [PATCH 3/5] acpi: Clear reserved bits in IORT
Date: Sun, 16 Mar 2025 09:32:54 +0100	[thread overview]
Message-ID: <20250316083300.2692377-3-patrick.rudolph@9elements.com> (raw)
In-Reply-To: <20250316083300.2692377-1-patrick.rudolph@9elements.com>

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 | 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


  parent reply	other threads:[~2025-03-16  8:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-16  8:32 [PATCH 1/5] acpi_table: Fix IORT RC node Patrick Rudolph
2025-03-16  8:32 ` [PATCH 2/5] acpi_table: Add asserts in IORT Patrick Rudolph
2025-03-16  8:32 ` Patrick Rudolph [this message]
2025-03-16  8:32 ` [PATCH 4/5] acpi: Conditionally set mapping_offset " Patrick Rudolph
2025-03-16  8:32 ` [PATCH 5/5] test: acpi: Add IORT tests Patrick Rudolph
2025-04-03 21:20 ` [PATCH 1/5] acpi_table: Fix IORT RC node Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250316083300.2692377-3-patrick.rudolph@9elements.com \
    --to=patrick.rudolph@9elements.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox