Commit 130797a6 authored by Lv Zheng's avatar Lv Zheng Committed by Rafael J. Wysocki

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: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 9187a415
...@@ -461,25 +461,28 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, ...@@ -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); 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 * Object is NULL, just return the length of union acpi_object
* element -- which is legal) * (A NULL union acpi_object is an object of all zeroes.)
*/ */
if (!internal_object) { *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length);
*obj_length = sizeof(union acpi_object);
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
/* Start with the length of the Acpi object */ /* A Namespace Node should never appear here */
length = sizeof(union acpi_object);
if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { 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(AE_AML_INTERNAL);
return_ACPI_STATUS(status);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment