From 8c76c0f45a681b1a1ce5f4e2b195c2ae95ad645b Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Thu, 3 Sep 2009 10:03:37 +0800 Subject: [PATCH] --- yaml --- r: 165215 b: refs/heads/master c: e3fe0913b8e732ae636cf23afca76cf2c30718e5 h: refs/heads/master i: 165213: f9d970d3e2bc1ba77a4d7ef9ee11eeb584d83bae 165211: ab148d3fdc65be1f57a616a89bc4661e7ae62a8b 165207: 5154eb1702a2c71c7ad31904eff59a2993de981f 165199: d536727a974e9b14267035267d3b04fb4e40fe08 165183: bf14682697bf2516addf7df6d5e659997288fb90 v: v3 --- [refs] | 2 +- trunk/drivers/acpi/acpica/dsobject.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 2e3fa2bd1c3d..df145d79a267 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e678902ee899f6b0ab48166b410cdc9f1c27a350 +refs/heads/master: e3fe0913b8e732ae636cf23afca76cf2c30718e5 diff --git a/trunk/drivers/acpi/acpica/dsobject.c b/trunk/drivers/acpi/acpica/dsobject.c index 02e6caad4a76..507e1f0bbdfd 100644 --- a/trunk/drivers/acpi/acpica/dsobject.c +++ b/trunk/drivers/acpi/acpica/dsobject.c @@ -482,14 +482,27 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, if (arg) { /* * num_elements was exhausted, but there are remaining elements in the - * package_list. + * package_list. Truncate the package to num_elements. * * Note: technically, this is an error, from ACPI spec: "It is an error * for NumElements to be less than the number of elements in the - * PackageList". However, for now, we just print an error message and - * no exception is returned. + * PackageList". However, we just print an error message and + * no exception is returned. This provides Windows compatibility. Some + * BIOSs will alter the num_elements on the fly, creating this type + * of ill-formed package object. */ while (arg) { + /* + * We must delete any package elements that were created earlier + * and are not going to be used because of the package truncation. + */ + if (arg->common.node) { + acpi_ut_remove_reference(ACPI_CAST_PTR + (union + acpi_operand_object, + arg->common.node)); + arg->common.node = NULL; + } /* Find out how many elements there really are */ @@ -498,7 +511,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, } ACPI_WARNING((AE_INFO, - "Package List length (%X) larger than NumElements count (%X), truncated\n", + "Package List length (0x%X) larger than NumElements count (0x%X), truncated\n", i, element_count)); } else if (i < element_count) { /* @@ -506,7 +519,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, * Note: this is not an error, the package is padded out with NULLs. */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", + "Package List length (0x%X) smaller than NumElements count (0x%X), padded with null elements\n", i, element_count)); }