diff options
Diffstat (limited to 'drivers/acpi/executer/exmisc.c')
-rw-r--r-- | drivers/acpi/executer/exmisc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 794d9b8de956..bd98aab017cf 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -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) */ |