Skip to contentSkip to conversation

arm64/acpi: Fix multiple issues in ACPI boot support code

PATCH In review Fidal Palamparambil 2 participants 2 messages Sep 6, 2025 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64/acpi: Fix multiple issues in ACPI boot support code

From: Fidal palamparambil <[email protected]>

- Fixed memory leak in acpi_fadt_sanity_check() by ensuring acpi_put_table() is called in all error paths
- Corrected error handling in parse_acpi() by removing incorrect snprintf() usage
- Added missing compiler_attributes.h include for fallthrough support
- Verified proper NULL pointer checks in acpi_os_ioremap()

These fixes address potential memory leaks, compilation warnings, and improper error handling in the ARM64 ACPI boot support code.

---
 arch/arm64/kernel/acpi.c    |  17 +-
 arch/arm64/kernel/acpi.orig | 466 ++++++++++++++++++++++++++++++++++++
 2 files changed, 480 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm64/kernel/acpi.orig
arch/arm64/kernel/acpi.c +14 -3
index 4d529ff7ba51..218f39e5ae0f 100644
@@ -14,6 +14,7 @@
 
 #include <linux/acpi.h>
 #include <linux/arm-smccc.h>
+#include <linux/compiler_attributes.h>
 #include <linux/cpumask.h>
 #include <linux/efi.h>
 #include <linux/efi-bgrt.h>
@@ -55,16 +56,26 @@ static int __init parse_acpi(char *arg)
 
 	/* "acpi=off" disables both ACPI table parsing and interpreter */
 	if (strcmp(arg, "off") == 0)
+	{
 		param_acpi_off = true;
+	}
 	else if (strcmp(arg, "on") == 0) /* prefer ACPI over DT */
+	{
 		param_acpi_on = true;
+	}
 	else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
+	{
 		param_acpi_force = true;
+	}
 	else if (strcmp(arg, "nospcr") == 0) /* disable SPCR as default console */
+	{
 		param_acpi_nospcr = true;
+	}
 	else
-		return -EINVAL;	/* Core will print when we return error */
-
+	{
+		pr_err("ACPI: Invalid option '%s'\n", arg);
+		return -EINVAL;
+	}
 	return 0;
 }
 early_param("acpi", parse_acpi);
@@ -463,4 +474,4 @@ int acpi_unmap_cpu(int cpu)
 	return 0;
 }
 EXPORT_SYMBOL(acpi_unmap_cpu);
-#endif /* CONFIG_ACPI_HOTPLUG_CPU */
+#endif /* CONFIG_ACPI_HOTPLUG_CPU */
\ No newline at end of file
arch/arm64/kernel/acpi.orig new file +466 -0

466 lines not on this page · raw message

Signature · 1 line
2.50.1.windows.1