Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
[linux-drm-fsl-dcu.git] / drivers / acpi / executer / exmisc.c
index 48c18d29222a4c1891a8b3e55478d4304a92d2bb..f13d1cec2d6db1a3d277a916e10ea0f8564d4dda 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2006, R. Byron Moore
+ * Copyright (C) 2000 - 2007, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -72,7 +72,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
        union acpi_operand_object *reference_obj;
        union acpi_operand_object *referenced_obj;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc);
+       ACPI_FUNCTION_TRACE_PTR(ex_get_object_reference, obj_desc);
 
        *return_desc = NULL;
 
@@ -168,7 +168,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0,
        acpi_size length1;
        acpi_size new_length;
 
-       ACPI_FUNCTION_TRACE("ex_concat_template");
+       ACPI_FUNCTION_TRACE(ex_concat_template);
 
        /*
         * Find the end_tag descriptor in each resource template.
@@ -250,7 +250,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
        char *new_buf;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("ex_do_concatenate");
+       ACPI_FUNCTION_TRACE(ex_do_concatenate);
 
        /*
         * 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)
 
        case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */
 
+               /*
+                * We need to check if the shiftcount is larger than the integer bit
+                * width since the behavior of this is not well-defined in the C language.
+                */
+               if (integer1 >= acpi_gbl_integer_bit_width) {
+                       return (0);
+               }
                return (integer0 << integer1);
 
        case AML_SHIFT_RIGHT_OP:        /* shift_right (Operand, shift_count, Result) */
 
+               /*
+                * We need to check if the shiftcount is larger than the integer bit
+                * width since the behavior of this is not well-defined in the C language.
+                */
+               if (integer1 >= acpi_gbl_integer_bit_width) {
+                       return (0);
+               }
                return (integer0 >> integer1);
 
        case AML_SUBTRACT_OP:   /* Subtract (Integer0, Integer1, Result) */
@@ -489,7 +503,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode,
        acpi_status status = AE_OK;
        u8 local_result = FALSE;
 
-       ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op");
+       ACPI_FUNCTION_TRACE(ex_do_logical_numeric_op);
 
        switch (opcode) {
        case AML_LAND_OP:       /* LAnd (Integer0, Integer1) */
@@ -557,7 +571,7 @@ acpi_ex_do_logical_op(u16 opcode,
        u8 local_result = FALSE;
        int compare;
 
-       ACPI_FUNCTION_TRACE("ex_do_logical_op");
+       ACPI_FUNCTION_TRACE(ex_do_logical_op);
 
        /*
         * Convert the second operand if necessary.  The first operand
@@ -649,6 +663,7 @@ acpi_ex_do_logical_op(u16 opcode,
                        /* Length and all bytes must be equal */
 
                        if ((length0 == length1) && (compare == 0)) {
+
                                /* Length and all bytes match ==> TRUE */
 
                                local_result = TRUE;