Comment 11 for bug 1942215

Revision history for this message
Colin Ian King (colin-king) wrote :

It may be be worth re-writing the check as follows to avoid underflow wrap:

if (walk_state->num_operands < 1 || walk_state->num_operands >= ARRAY_SIZE(walk_state->operands) + 1) {
   ACPI_ERROR((AE_INFO, "Illegal number of operands 0x%X for op_type 0x%X", walk_state->num_operands - 1, op_type));
   status = AE_AML_BAD_OPCODE;
   goto cleanup;
}

Note: if a fix is sent upstream they will nack-it on the ARRAY_SIZE() macro because the ACPCIA core does not support this macro and the code is derived from that code base. I've added notes to the upstream ACPICA bug report so that it will get fixed using their coding standards.