[PATCH v1 18/30] ACPICA: parser: Set AML length for bytelist
From: Pawel Chmielewski
Date: Tue Oct 20 2026 - 10:23:22 EST
From: Rong Zhang <i@xxxxxxxx>
The sanity check introduced in [1] leads to failures for
resource templates. AcpiDmIsResourceTemplate compares the Length
variable to BufferLength - the problem being that Length was never
set. This causes the decompiler to decompile valid resource
templates as plain buffers.
Fix it by setting the AML length properly.
[1] https://github.com/open-acpica/acpica/commit/3ce09021b677
Link: https://github.com/acpica/acpica/commit/bb546a65fa3e
Signed-off-by: Rong Zhang <i@xxxxxxxx>
Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@xxxxxxxxx>
Signed-off-by: Pawel Chmielewski <pawel.chmielewski@xxxxxxxxx>
---
drivers/acpi/acpica/psargs.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c
index 4643c839df7f..b0f5a11f9696 100644
--- a/drivers/acpi/acpica/psargs.c
+++ b/drivers/acpi/acpica/psargs.c
@@ -760,6 +760,8 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
ASL_CV_CAPTURE_COMMENTS_ONLY(parser_state);
arg->named.value.size = buffer_length;
+ arg->named.length = (u32)ACPI_PTR_DIFF(
+ pkg_end, parser_state->aml);
arg->named.data = parser_state->aml;
}
@@ -933,9 +935,9 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
/* Fill in bytelist data */
- arg->common.value.size = (u32)
- ACPI_PTR_DIFF(parser_state->pkg_end,
- parser_state->aml);
+ arg->common.value.size = arg->named.length =
+ (u32)ACPI_PTR_DIFF(parser_state->pkg_end,
+ parser_state->aml);
arg->named.data = parser_state->aml;
/* Skip to End of byte data */
--
2.50.1