Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174336
b: refs/heads/master
c: 419a909
h: refs/heads/master
v: v3
  • Loading branch information
Bob Moore authored and Len Brown committed Nov 25, 2009
1 parent 5270c65 commit 2d58208
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2263576cfc6e8f6ab038126c3254404b9fcb1c33
refs/heads/master: 419a909dd10142d015dd96457db1b1eda643f89e
43 changes: 42 additions & 1 deletion trunk/drivers/acpi/acpica/nspredef.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,8 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
* there is only one entry). We may be able to repair this by
* wrapping the returned Package with a new outer Package.
*/
if ((*elements)->common.type != ACPI_TYPE_PACKAGE) {
if (*elements
&& ((*elements)->common.type != ACPI_TYPE_PACKAGE)) {

/* Create the new outer package and populate it */

Expand Down Expand Up @@ -673,13 +674,53 @@ acpi_ns_check_package_list(struct acpi_predefined_data *data,
union acpi_operand_object *sub_package;
union acpi_operand_object **sub_elements;
acpi_status status;
u8 non_trailing_null = FALSE;
u32 expected_count;
u32 i;
u32 j;

/* Validate each sub-Package in the parent Package */

for (i = 0; i < count; i++) {
/*
* Handling for NULL package elements. For now, we will simply allow
* a parent package with trailing NULL elements. This can happen if
* the package was defined to be longer than the initializer list.
* This is legal as per the ACPI specification. It is often used
* to allow for dynamic initialization of a Package.
*
* A future enhancement may be to simply truncate the package to
* remove the trailing NULL elements.
*/
if (!(*elements)) {
if (!non_trailing_null) {

/* Ensure the remaining elements are all NULL */

for (j = 1; j < (count - i + 1); j++) {
if (elements[j]) {
non_trailing_null = TRUE;
}
}

if (!non_trailing_null) {

/* Ignore the trailing NULL elements */

return (AE_OK);
}
}

/* There are trailing non-null elements, issue warning */

ACPI_WARN_PREDEFINED((AE_INFO, data->pathname,
data->node_flags,
"Found NULL element at package index %u",
i));
elements++;
continue;
}

sub_package = *elements;
sub_elements = sub_package->package.elements;

Expand Down

0 comments on commit 2d58208

Please sign in to comment.