Skip to content

Commit

Permalink
ACPICA: New: Validation for predefined ACPI methods/objects
Browse files Browse the repository at this point in the history
Validates predefined ACPI objects that appear in the namespace,
at the time they are evaluated. The argument count and the type of
the returned object are validated. The purpose of this validation
is to detect problems with the BIOS-exposed predefined ACPI objects
before the results are returned to the ACPI-related drivers.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Bob Moore authored and Len Brown committed Oct 23, 2008
1 parent b9d1312 commit e8707b3
Show file tree
Hide file tree
Showing 8 changed files with 1,401 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/acpi/namespace/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
obj-y := nsaccess.o nsload.o nssearch.o nsxfeval.o \
nsalloc.o nseval.o nsnames.o nsutils.o nsxfname.o \
nsdump.o nsinit.o nsobject.o nswalk.o nsxfobj.o \
nsparse.o
nsparse.o nspredef.o

obj-$(ACPI_FUTURE_USAGE) += nsdumpdv.o

Expand Down
35 changes: 32 additions & 3 deletions drivers/acpi/namespace/nseval.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ ACPI_MODULE_NAME("nseval")
acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
{
acpi_status status;
struct acpi_namespace_node *node;

ACPI_FUNCTION_TRACE(ns_evaluate);

Expand Down Expand Up @@ -117,6 +118,8 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
info->resolved_node,
acpi_ns_get_attached_object(info->resolved_node)));

node = info->resolved_node;

/*
* Two major cases here:
*
Expand Down Expand Up @@ -261,9 +264,35 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info * info)
}
}

/*
* Check if there is a return value that must be dealt with
*/
/* Validation of return values for ACPI-predefined methods and objects */

if ((status == AE_OK) || (status == AE_CTRL_RETURN_VALUE)) {
/*
* If this is the first evaluation, check the return value. This
* ensures that any warnings will only be emitted during the very
* first evaluation of the object.
*/
if (!(node->flags & ANOBJ_EVALUATED)) {
/*
* Check for a predefined ACPI name. If found, validate the
* returned object.
*
* Note: Ignore return status for now, emit warnings if there are
* problems with the returned object. May change later to abort
* the method on invalid return object.
*/
(void)acpi_ns_check_predefined_names(node,
info->
return_object);
}

/* Mark the node as having been evaluated */

node->flags |= ANOBJ_EVALUATED;
}

/* Check if there is a return value that must be dealt with */

if (status == AE_CTRL_RETURN_VALUE) {

/* If caller does not want the return value, delete it */
Expand Down
2 changes: 0 additions & 2 deletions drivers/acpi/namespace/nsnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
return (AE_OK);
}

#ifdef ACPI_DEBUG_OUTPUT
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_external_pathname
Expand Down Expand Up @@ -163,7 +162,6 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)

return_PTR(name_buffer);
}
#endif

/*******************************************************************************
*
Expand Down
Loading

0 comments on commit e8707b3

Please sign in to comment.