[PATCH v2 2/2] x86: acpi: Add memset to initialize SPCR table

Wolfgang Wallner wolfgang.wallner at br-automation.com
Wed Sep 16 16:57:53 CEST 2020


Add a missing memset to acpi_create_spcr().

The other acpi_create_xxxx() functions perform a memset on their
structures, acpi_create_spcr() does not and as a result the contents of
this table are partly uninitialized (and thus random after every reset).

Fixes: commit b288cd960072 ("x86: acpi: Generate SPCR table")

Signed-off-by: Wolfgang Wallner <wolfgang.wallner at br-automation.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
Reviewed-by: Simon Glass <sjg at chromium.org>

---

Changes in v2:
 - Removed unrelated whitespace change
 - Added Reviewed-by tags

 arch/x86/lib/acpi_table.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 6b827bfa3f..c445aa6870 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -252,6 +252,8 @@ static void acpi_create_spcr(struct acpi_spcr *spcr)
 	int space_id;
 	int ret = -ENODEV;
 
+	memset((void *)spcr, 0, sizeof(struct acpi_spcr));
+
 	/* Fill out header fields */
 	acpi_fill_header(header, "SPCR");
 	header->length = sizeof(struct acpi_spcr);
-- 
2.28.0




More information about the U-Boot mailing list