[PATCH v1 28/30] ACPICA: iASL: Fix the truncated count of external control methods

From: Pawel Chmielewski

Date: Tue Oct 20 2026 - 10:32:26 EST


From: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>

AcpiGbl_NumExternalMethods counts the external control methods that the
disassembler finds in a table. Its type is BOOLEAN, which is an unsigned
char, so the counter wraps at 256. A table with more than 255 external
control methods gets a wrong count.

The wrong count makes the disassembler print a bogus warning.
AcpiGbl_ResolvedExternalMethods is a UINT32 and keeps the correct value.
The two counts then differ, even when the disassembler resolves every
method. AcpiDmUnresolvedWarning() subtracts the counts to get the number
of unresolved methods. That unsigned subtraction wraps and gives a very
large number. A table with 300 externals, all of them resolved, reports
"There were 44 external control methods found during disassembly, but
only 300 were resolved (4294967040 unresolved)".

A count that is an exact multiple of 256 truncates to zero. In that case
AcpiDmUnresolvedWarning() returns early and prints no warning at all,
even when methods stay unresolved.

Change the type of AcpiGbl_NumExternalMethods to UINT32, which is the
type of AcpiGbl_ResolvedExternalMethods.

Link: https://github.com/acpica/acpica/commit/36a5217a09bd
Link: https://github.com/open-acpica/acpica/pull/1221
Originally-by: abhinavmir <atg271@xxxxxxxxx>
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
Signed-off-by: Pawel Chmielewski <pawel.chmielewski@xxxxxxxxx>
---
drivers/acpi/acpica/acglobal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 08b8270b10de..5294983a6795 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -294,7 +294,7 @@ ACPI_INIT_GLOBAL(ACPI_PARSE_OBJECT_LIST, *acpi_gbl_temp_list_head, NULL);

ACPI_GLOBAL(u8, acpi_gbl_dm_opt_disasm);
ACPI_GLOBAL(u8, acpi_gbl_dm_opt_listing);
-ACPI_GLOBAL(u8, acpi_gbl_num_external_methods);
+ACPI_GLOBAL(u32, acpi_gbl_num_external_methods);
ACPI_GLOBAL(u32, acpi_gbl_resolved_external_methods);
ACPI_GLOBAL(struct acpi_external_list *, acpi_gbl_external_list);
ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list);
--
2.50.1