aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/components/dispatcher/dsmethod.c')
-rw-r--r--sys/contrib/dev/acpica/components/dispatcher/dsmethod.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c b/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
index 8b6efc070b1b..becdb95f8b83 100644
--- a/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
+++ b/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
@@ -646,8 +646,6 @@ AcpiDsCallControlMethod (
ACPI_WALK_STATE *NextWalkState = NULL;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_EVALUATE_INFO *Info;
- UINT32 i;
-
ACPI_FUNCTION_TRACE_PTR (DsCallControlMethod, ThisWalkState);
@@ -670,6 +668,23 @@ AcpiDsCallControlMethod (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
+ if (ThisWalkState->NumOperands < ObjDesc->Method.ParamCount)
+ {
+ ACPI_ERROR ((AE_INFO, "Missing argument(s) for method [%4.4s]",
+ AcpiUtGetNodeName (MethodNode)));
+
+ return_ACPI_STATUS (AE_AML_TOO_FEW_ARGUMENTS);
+ }
+
+ else if (ThisWalkState->NumOperands > ObjDesc->Method.ParamCount)
+ {
+ ACPI_ERROR ((AE_INFO, "Too many arguments for method [%4.4s]",
+ AcpiUtGetNodeName (MethodNode)));
+
+ return_ACPI_STATUS (AE_AML_TOO_MANY_ARGUMENTS);
+ }
+
+
/* Init for new method, possibly wait on method mutex */
Status = AcpiDsBeginMethodExecution (
@@ -726,15 +741,7 @@ AcpiDsCallControlMethod (
* Delete the operands on the previous walkstate operand stack
* (they were copied to new objects)
*/
- for (i = 0; i < ObjDesc->Method.ParamCount; i++)
- {
- AcpiUtRemoveReference (ThisWalkState->Operands [i]);
- ThisWalkState->Operands [i] = NULL;
- }
-
- /* Clear the operand stack */
-
- ThisWalkState->NumOperands = 0;
+ AcpiDsClearOperands (ThisWalkState);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Begin nested execution of [%4.4s] **** WalkState=%p\n",