Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPICA: Print error messages for too few or too many arguments

Fix Issue #1027 by displaying error messages when there are too few or
too many arguments in the caller vs the definition of an ASL/AML method.

Link: https://github.com/acpica/acpica/commit/cbc243e4
Reported-by: Peter Williams <peter@newton.cx>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Saket Dumbre <saket.dumbre@intel.com>

authored by

Saket Dumbre and committed by
Rafael J. Wysocki
e2c80b3c 761dc71c

+17 -4
+9 -2
drivers/acpi/acpica/dsmethod.c
··· 483 483 } 484 484 485 485 if (this_walk_state->num_operands < obj_desc->method.param_count) { 486 - ACPI_ERROR((AE_INFO, "Missing argument for method [%4.4s]", 486 + ACPI_ERROR((AE_INFO, "Missing argument(s) for method [%4.4s]", 487 487 acpi_ut_get_node_name(method_node))); 488 488 489 - return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); 489 + return_ACPI_STATUS(AE_AML_TOO_FEW_ARGUMENTS); 490 + } 491 + 492 + else if (this_walk_state->num_operands > obj_desc->method.param_count) { 493 + ACPI_ERROR((AE_INFO, "Too many arguments for method [%4.4s]", 494 + acpi_ut_get_node_name(method_node))); 495 + 496 + return_ACPI_STATUS(AE_AML_TOO_MANY_ARGUMENTS); 490 497 } 491 498 492 499 /* Init for new method, possibly wait on method mutex */
+8 -2
include/acpi/acexcep.h
··· 173 173 #define AE_AML_TARGET_TYPE EXCEP_AML (0x0023) 174 174 #define AE_AML_PROTOCOL EXCEP_AML (0x0024) 175 175 #define AE_AML_BUFFER_LENGTH EXCEP_AML (0x0025) 176 + #define AE_AML_TOO_FEW_ARGUMENTS EXCEP_AML (0x0026) 177 + #define AE_AML_TOO_MANY_ARGUMENTS EXCEP_AML (0x0027) 176 178 177 - #define AE_CODE_AML_MAX 0x0025 179 + #define AE_CODE_AML_MAX 0x0027 178 180 179 181 /* 180 182 * Internal exceptions used for control ··· 355 353 "A target operand of an incorrect type was encountered"), 356 354 EXCEP_TXT("AE_AML_PROTOCOL", "Violation of a fixed ACPI protocol"), 357 355 EXCEP_TXT("AE_AML_BUFFER_LENGTH", 358 - "The length of the buffer is invalid/incorrect") 356 + "The length of the buffer is invalid/incorrect"), 357 + EXCEP_TXT("AE_AML_TOO_FEW_ARGUMENTS", 358 + "There are fewer than expected method arguments"), 359 + EXCEP_TXT("AE_AML_TOO_MANY_ARGUMENTS", 360 + "There are too many arguments for this method") 359 361 }; 360 362 361 363 static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = {