summaryrefslogtreecommitdiff
path: root/drivers/acpi/acpica/exutils.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2012-12-31 04:07:18 +0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-10 15:36:22 +0400
commitef42e53f271b99fe9eb853df5661edeac8a277f6 (patch)
treeaccdeb45436b2278086375374b5d88b529834253 /drivers/acpi/acpica/exutils.c
parent3e5621a750e2cfb26748c34acbb67c691845494a (diff)
downloadlinux-ef42e53f271b99fe9eb853df5661edeac8a277f6.tar.xz
ACPICA: Interpreter: Add warning if 64-bit constant appears in 32-bit table.
Some ASL compilers allow 64-bit constants within a 32-bit table (DSDT version == 1). When encountered, emit a warning that the constant will be truncated to 32 bits. This is potentially a serious problem in the ACPI table(s). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/exutils.c')
-rw-r--r--drivers/acpi/acpica/exutils.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 02ddc4ceca37..e624958f33b8 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -202,35 +202,39 @@ void acpi_ex_relinquish_interpreter(void)
*
* PARAMETERS: obj_desc - Object to be truncated
*
- * RETURN: none
+ * RETURN: TRUE if a truncation was performed, FALSE otherwise.
*
* DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is
* 32-bit, as determined by the revision of the DSDT.
*
******************************************************************************/
-void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
+u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
{
ACPI_FUNCTION_ENTRY();
/*
* Object must be a valid number and we must be executing
- * a control method. NS node could be there for AML_INT_NAMEPATH_OP.
+ * a control method. Object could be NS node for AML_INT_NAMEPATH_OP.
*/
if ((!obj_desc) ||
(ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) ||
(obj_desc->common.type != ACPI_TYPE_INTEGER)) {
- return;
+ return (FALSE);
}
- if (acpi_gbl_integer_byte_width == 4) {
+ if ((acpi_gbl_integer_byte_width == 4) &&
+ (obj_desc->integer.value > (u64)ACPI_UINT32_MAX)) {
/*
- * We are running a method that exists in a 32-bit ACPI table.
+ * We are executing in a 32-bit ACPI table.
* Truncate the value to 32 bits by zeroing out the upper 32-bit field
*/
- obj_desc->integer.value &= (u64) ACPI_UINT32_MAX;
+ obj_desc->integer.value &= (u64)ACPI_UINT32_MAX;
+ return (TRUE);
}
+
+ return (FALSE);
}
/*******************************************************************************