summaryrefslogtreecommitdiff
path: root/drivers/acpi/acpica/utobject.c
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2013-10-31 05:30:36 +0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-31 17:37:33 +0400
commit130797a6c3f1421c10880a1681d6a9c57b80ef17 (patch)
tree707e88e530660a340963b5482b4584324426b81e /drivers/acpi/acpica/utobject.c
parent9187a415fd119c1d89a5ad2fd05513cd43699ebf (diff)
downloadlinux-130797a6c3f1421c10880a1681d6a9c57b80ef17.tar.xz
ACPICA: Fix wrong object length returned by acpi_ut_get_simple_object_size().
The object length returned by acpi_ut_get_simple_object_size() should be rounded up to the closest word boundary. This patch ports a fix from ACPICA upstream to Linux. [rjw: Changelog] 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/utobject.c')
-rw-r--r--drivers/acpi/acpica/utobject.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
index aa61f66ee861..cddb0ef5b9b7 100644
--- a/drivers/acpi/acpica/utobject.c
+++ b/drivers/acpi/acpica/utobject.c
@@ -461,25 +461,28 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object);
+ /* Start with the length of the (external) Acpi object */
+
+ length = sizeof(union acpi_object);
+
+ /* A NULL object is allowed, can be a legal uninitialized package element */
+
+ if (!internal_object) {
/*
- * Handle a null object (Could be a uninitialized package
- * element -- which is legal)
+ * Object is NULL, just return the length of union acpi_object
+ * (A NULL union acpi_object is an object of all zeroes.)
*/
- if (!internal_object) {
- *obj_length = sizeof(union acpi_object);
+ *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
return_ACPI_STATUS(AE_OK);
}
- /* Start with the length of the Acpi object */
-
- length = sizeof(union acpi_object);
+ /* A Namespace Node should never appear here */
if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) {
- /* Object is a named object (reference), just return the length */
+ /* A namespace node should never get here */
- *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
- return_ACPI_STATUS(status);
+ return_ACPI_STATUS(AE_AML_INTERNAL);
}
/*