Skip to content

Commit e2c80b3

Browse files
SaketADumbrerafaeljw
authored andcommitted
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: acpica/acpica@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>
1 parent 761dc71 commit e2c80b3

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

drivers/acpi/acpica/dsmethod.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,17 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
483483
}
484484

485485
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]",
487487
acpi_ut_get_node_name(method_node)));
488488

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);
490497
}
491498

492499
/* Init for new method, possibly wait on method mutex */

include/acpi/acexcep.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,10 @@ struct acpi_exception_info {
173173
#define AE_AML_TARGET_TYPE EXCEP_AML (0x0023)
174174
#define AE_AML_PROTOCOL EXCEP_AML (0x0024)
175175
#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)
176178

177-
#define AE_CODE_AML_MAX 0x0025
179+
#define AE_CODE_AML_MAX 0x0027
178180

179181
/*
180182
* Internal exceptions used for control
@@ -353,7 +355,11 @@ static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = {
353355
"A target operand of an incorrect type was encountered"),
354356
EXCEP_TXT("AE_AML_PROTOCOL", "Violation of a fixed ACPI protocol"),
355357
EXCEP_TXT("AE_AML_BUFFER_LENGTH",
356-
"The length of the buffer is invalid/incorrect")
358+
"The length of the buffer is invalid/incorrect"),
359+
EXCEP_TXT("AE_AML_TOO_FEW_ARGUMENTS",
360+
"There are fewer than expected method arguments"),
361+
EXCEP_TXT("AE_AML_TOO_MANY_ARGUMENTS",
362+
"There are too many arguments for this method")
357363
};
358364

359365
static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = {

0 commit comments

Comments
 (0)