diff options
Diffstat (limited to 'drivers/acpi/executer/exmisc.c')
-rw-r--r-- | drivers/acpi/executer/exmisc.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 48c18d29222a..bd98aab017cf 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -72,7 +72,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
72 | union acpi_operand_object *reference_obj; | 72 | union acpi_operand_object *reference_obj; |
73 | union acpi_operand_object *referenced_obj; | 73 | union acpi_operand_object *referenced_obj; |
74 | 74 | ||
75 | ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc); | 75 | ACPI_FUNCTION_TRACE_PTR(ex_get_object_reference, obj_desc); |
76 | 76 | ||
77 | *return_desc = NULL; | 77 | *return_desc = NULL; |
78 | 78 | ||
@@ -168,7 +168,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
168 | acpi_size length1; | 168 | acpi_size length1; |
169 | acpi_size new_length; | 169 | acpi_size new_length; |
170 | 170 | ||
171 | ACPI_FUNCTION_TRACE("ex_concat_template"); | 171 | ACPI_FUNCTION_TRACE(ex_concat_template); |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * Find the end_tag descriptor in each resource template. | 174 | * Find the end_tag descriptor in each resource template. |
@@ -250,7 +250,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
250 | char *new_buf; | 250 | char *new_buf; |
251 | acpi_status status; | 251 | acpi_status status; |
252 | 252 | ||
253 | ACPI_FUNCTION_TRACE("ex_do_concatenate"); | 253 | ACPI_FUNCTION_TRACE(ex_do_concatenate); |
254 | 254 | ||
255 | /* | 255 | /* |
256 | * Convert the second operand if necessary. The first operand | 256 | * Convert the second operand if necessary. The first operand |
@@ -445,10 +445,24 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) | |||
445 | 445 | ||
446 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ | 446 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ |
447 | 447 | ||
448 | /* | ||
449 | * We need to check if the shiftcount is larger than the integer bit | ||
450 | * width since the behavior of this is not well-defined in the C language. | ||
451 | */ | ||
452 | if (integer1 >= acpi_gbl_integer_bit_width) { | ||
453 | return (0); | ||
454 | } | ||
448 | return (integer0 << integer1); | 455 | return (integer0 << integer1); |
449 | 456 | ||
450 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ | 457 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ |
451 | 458 | ||
459 | /* | ||
460 | * We need to check if the shiftcount is larger than the integer bit | ||
461 | * width since the behavior of this is not well-defined in the C language. | ||
462 | */ | ||
463 | if (integer1 >= acpi_gbl_integer_bit_width) { | ||
464 | return (0); | ||
465 | } | ||
452 | return (integer0 >> integer1); | 466 | return (integer0 >> integer1); |
453 | 467 | ||
454 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ | 468 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ |
@@ -489,7 +503,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode, | |||
489 | acpi_status status = AE_OK; | 503 | acpi_status status = AE_OK; |
490 | u8 local_result = FALSE; | 504 | u8 local_result = FALSE; |
491 | 505 | ||
492 | ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op"); | 506 | ACPI_FUNCTION_TRACE(ex_do_logical_numeric_op); |
493 | 507 | ||
494 | switch (opcode) { | 508 | switch (opcode) { |
495 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ | 509 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ |
@@ -557,7 +571,7 @@ acpi_ex_do_logical_op(u16 opcode, | |||
557 | u8 local_result = FALSE; | 571 | u8 local_result = FALSE; |
558 | int compare; | 572 | int compare; |
559 | 573 | ||
560 | ACPI_FUNCTION_TRACE("ex_do_logical_op"); | 574 | ACPI_FUNCTION_TRACE(ex_do_logical_op); |
561 | 575 | ||
562 | /* | 576 | /* |
563 | * Convert the second operand if necessary. The first operand | 577 | * Convert the second operand if necessary. The first operand |
@@ -649,6 +663,7 @@ acpi_ex_do_logical_op(u16 opcode, | |||
649 | /* Length and all bytes must be equal */ | 663 | /* Length and all bytes must be equal */ |
650 | 664 | ||
651 | if ((length0 == length1) && (compare == 0)) { | 665 | if ((length0 == length1) && (compare == 0)) { |
666 | |||
652 | /* Length and all bytes match ==> TRUE */ | 667 | /* Length and all bytes match ==> TRUE */ |
653 | 668 | ||
654 | local_result = TRUE; | 669 | local_result = TRUE; |