Fix various bugs found by Coverity Prevent. --- debugger/dbxface.c 22 Mar 2007 18:02:34 -0000 1.10 +++ debugger/dbxface.c 29 Mar 2007 21:47:10 -0000 @@ -380,7 +380,8 @@ if ((Op->Common.AmlOpcode == AML_IF_OP) || (Op->Common.AmlOpcode == AML_WHILE_OP)) { - if (WalkState->ControlState->Common.Value) + if ((WalkState->ControlState) && + (WalkState->ControlState->Common.Value)) { AcpiOsPrintf ("Predicate = [True], IF block was executed\n"); } --- disassembler/dmwalk.c 22 Mar 2007 17:23:30 -0000 1.1.1.11 +++ disassembler/dmwalk.c 29 Mar 2007 21:47:11 -0000 @@ -1023,7 +1023,7 @@ AcpiDmIndent (Level - 1); AcpiOsPrintf ("{\n"); } - else + else if (Op->Common.Parent) { Op->Common.Parent->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST; --- interpreter/dispatcher/dsmethod.c 22 Mar 2007 17:23:39 -0000 1.1.1.27 +++ interpreter/dispatcher/dsmethod.c 29 Mar 2007 21:47:11 -0000 @@ -682,8 +682,11 @@ MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--; if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth) { - WalkState->Thread->CurrentSyncLevel = - MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; + if (WalkState) + { + WalkState->Thread->CurrentSyncLevel = + MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; + } AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex); MethodDesc->Method.Mutex->Mutex.ThreadId = 0; --- interpreter/dispatcher/dsopcode.c 22 Mar 2007 17:23:39 -0000 1.1.1.28 +++ interpreter/dispatcher/dsopcode.c 29 Mar 2007 21:47:12 -0000 @@ -298,6 +298,11 @@ /* Get the AML pointer (method object) and BufferField node */ ExtraDesc = AcpiNsGetSecondaryObject (ObjDesc); + if (!ExtraDesc) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + Node = ObjDesc->BufferField.Node; ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (ACPI_TYPE_BUFFER_FIELD, Node, NULL)); --- interpreter/executer/exmutex.c 22 Mar 2007 17:23:41 -0000 1.1.1.14 +++ interpreter/executer/exmutex.c 29 Mar 2007 21:47:12 -0000 @@ -480,6 +480,15 @@ return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); } + /* Must have a valid thread ID */ + + if (!WalkState->Thread) + { + ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", + AcpiUtGetNodeName (ObjDesc->Mutex.Node))); + return_ACPI_STATUS (AE_AML_INTERNAL); + } + /* * The Mutex is owned, but this thread must be the owner. * Special case for Global Lock, any thread can release @@ -495,15 +504,6 @@ return_ACPI_STATUS (AE_AML_NOT_OWNER); } - /* Must have a valid thread ID */ - - if (!WalkState->Thread) - { - ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", - AcpiUtGetNodeName (ObjDesc->Mutex.Node))); - return_ACPI_STATUS (AE_AML_INTERNAL); - } - /* * The sync level of the mutex must be less than or equal to the current * sync level --- interpreter/executer/exoparg3.c 22 Mar 2007 17:23:42 -0000 1.1.1.11 +++ interpreter/executer/exoparg3.c 29 Mar 2007 21:47:12 -0000 @@ -200,7 +200,8 @@ /* Might return while OS is shutting down, just continue */ - ACPI_FREE (Fatal); + if (Fatal) + ACPI_FREE (Fatal); break; --- namespace/nsdump.c 22 Mar 2007 17:23:46 -0000 1.1.1.27 +++ namespace/nsdump.c 29 Mar 2007 21:47:12 -0000 @@ -288,6 +288,13 @@ } ThisNode = AcpiNsMapHandleToNode (ObjHandle); + + if (!ThisNode) + { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null name table entry\n")); + return (AE_OK); + } + Type = ThisNode->Type; /* Check if the owner matches */