From c0a8fa9ae42ad38aa761d63146ddfb84cf3f03b1 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Tue, 6 May 2008 15:00:00 -0700 Subject: [PATCH] Fix for extraneous debug message for packages. Fixed a problem where an extraneous debug message was produced for package objects (when debugging enabled). The message "Package List length larger than NumElements count" is now produced in the correct case, and is also an error message rather than a debug message. Added a debug message for the opposite case, where NumElements is larger than the Package List, and the package has been padded out with NULL elements. --- source/components/dispatcher/dsobject.c | 37 ++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/source/components/dispatcher/dsobject.c b/source/components/dispatcher/dsobject.c index 898fc4962..2c100bc44 100644 --- a/source/components/dispatcher/dsobject.c +++ b/source/components/dispatcher/dsobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines - * $Revision: 1.139 $ + * $Revision: 1.140 $ * *****************************************************************************/ @@ -564,11 +564,40 @@ AcpiDsBuildInternalPackageObj ( Arg = Arg->Common.Next; } - if (!Arg) + /* Check for match between NumElements and actual length of PackageList */ + + if (Arg) { + /* + * NumElements was exhausted, but there are remaining elements in the + * PackageList. + * + * 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. + */ + while (Arg) + { + /* Find out how many elements there really are */ + + i++; + Arg = Arg->Common.Next; + } + + ACPI_ERROR ((AE_INFO, + "Package List length (%X) larger than NumElements count (%X), truncated\n", + i, ElementCount)); + } + else if (i < ElementCount) + { + /* + * Arg list (elements) was exhausted, but we did not reach NumElements count. + * Note: this is not an error, the package is padded out with NULLs. + */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Package List length larger than NumElements count (%X), truncated\n", - ElementCount)); + "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", + i, ElementCount)); } ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;