]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Check the pointer before use it.
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 1 Sep 2011 08:44:08 +0000 (08:44 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 1 Sep 2011 08:44:08 +0000 (08:44 +0000)
Signed-off-by:ydong10
Reviewed-by:vanjeff

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12251 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupportAcpiSupportProtocol.c

index 6312e2ba363a19088cb395770273cd150d8e4cc4..1a28f0293347c45d57d3020f8e81452095285a80 100644 (file)
@@ -804,45 +804,46 @@ AddTableToList (
           &Buffer64,\r
           sizeof (UINT64)\r
           );\r
-      }\r
-      //\r
-      // RSDP OEM information is updated to match the FADT OEM information\r
-      //\r
-      CopyMem (\r
-        &AcpiSupportInstance->Rsdp3->OemId,\r
-        &AcpiSupportInstance->Fadt3->Header.OemId,\r
-        6\r
-        );\r
 \r
-      //\r
-      // RSDT OEM information is updated to match FADT OEM information.\r
-      //\r
-      CopyMem (\r
-        &AcpiSupportInstance->Rsdt3->OemId,\r
-        &AcpiSupportInstance->Fadt3->Header.OemId,\r
-        6\r
-        );\r
-      CopyMem (\r
-        &AcpiSupportInstance->Rsdt3->OemTableId,\r
-        &AcpiSupportInstance->Fadt3->Header.OemTableId,\r
-        sizeof (UINT64)\r
-        );\r
-      AcpiSupportInstance->Rsdt3->OemRevision = AcpiSupportInstance->Fadt3->Header.OemRevision;\r
+        //\r
+        // RSDP OEM information is updated to match the FADT OEM information\r
+        //\r
+        CopyMem (\r
+          &AcpiSupportInstance->Rsdp3->OemId,\r
+          &AcpiSupportInstance->Fadt3->Header.OemId,\r
+          6\r
+          );\r
 \r
-      //\r
-      // XSDT OEM information is updated to match FADT OEM information.\r
-      //\r
-      CopyMem (\r
-        &AcpiSupportInstance->Xsdt->OemId,\r
-        &AcpiSupportInstance->Fadt3->Header.OemId,\r
-        6\r
-        );\r
-      CopyMem (\r
-        &AcpiSupportInstance->Xsdt->OemTableId,\r
-        &AcpiSupportInstance->Fadt3->Header.OemTableId,\r
-        sizeof (UINT64)\r
-        );\r
-      AcpiSupportInstance->Xsdt->OemRevision = AcpiSupportInstance->Fadt3->Header.OemRevision;\r
+        //\r
+        // RSDT OEM information is updated to match FADT OEM information.\r
+        //\r
+        CopyMem (\r
+          &AcpiSupportInstance->Rsdt3->OemId,\r
+          &AcpiSupportInstance->Fadt3->Header.OemId,\r
+          6\r
+          );\r
+        CopyMem (\r
+          &AcpiSupportInstance->Rsdt3->OemTableId,\r
+          &AcpiSupportInstance->Fadt3->Header.OemTableId,\r
+          sizeof (UINT64)\r
+          );\r
+        AcpiSupportInstance->Rsdt3->OemRevision = AcpiSupportInstance->Fadt3->Header.OemRevision;\r
+\r
+        //\r
+        // XSDT OEM information is updated to match FADT OEM information.\r
+        //\r
+        CopyMem (\r
+          &AcpiSupportInstance->Xsdt->OemId,\r
+          &AcpiSupportInstance->Fadt3->Header.OemId,\r
+          6\r
+          );\r
+        CopyMem (\r
+          &AcpiSupportInstance->Xsdt->OemTableId,\r
+          &AcpiSupportInstance->Fadt3->Header.OemTableId,\r
+          sizeof (UINT64)\r
+          );\r
+        AcpiSupportInstance->Xsdt->OemRevision = AcpiSupportInstance->Fadt3->Header.OemRevision;\r
+      }\r
     }    \r
     //\r
     // Checksum the table\r
@@ -1336,40 +1337,42 @@ DeleteTable (
   // Init locals\r
   //\r
   RemoveFromRsdt        = TRUE;\r
-  CurrentTableSignature = ((EFI_ACPI_COMMON_HEADER *) Table->Table)->Signature;\r
-\r
-  //\r
-  // Basic tasks to accomplish delete are:\r
-  //   Determine removal requirements (in RSDT/XSDT or not)\r
-  //   Remove entry from RSDT/XSDT\r
-  //   Remove any table references to the table\r
-  //   If no one is using the table\r
-  //      Free the table (removing pointers from private data and tables)\r
-  //      Remove from list\r
-  //      Free list structure\r
-  //\r
-  //\r
-  // Determine if this table is in the RSDT or XSDT\r
-  //\r
-  if ((CurrentTableSignature == EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ||\r
-      (CurrentTableSignature == EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) ||\r
-      (CurrentTableSignature == EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)\r
-      ) {\r
-    RemoveFromRsdt = FALSE;\r
-  }\r
-  //\r
-  // We don't remove the FADT in the standard way because some\r
-  // OS expect the FADT to be early in the table list.\r
-  // So we always put it as the first element in the list.\r
-  //\r
-  if (CurrentTableSignature == EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {\r
-    RemoveFromRsdt = FALSE;\r
-  }\r
 \r
-  //\r
-  // Remove the table from RSDT and XSDT\r
-  //\r
   if (Table->Table != NULL) {\r
+    CurrentTableSignature = ((EFI_ACPI_COMMON_HEADER *) Table->Table)->Signature;\r
+\r
+    //\r
+    // Basic tasks to accomplish delete are:\r
+    //   Determine removal requirements (in RSDT/XSDT or not)\r
+    //   Remove entry from RSDT/XSDT\r
+    //   Remove any table references to the table\r
+    //   If no one is using the table\r
+    //      Free the table (removing pointers from private data and tables)\r
+    //      Remove from list\r
+    //      Free list structure\r
+    //\r
+    //\r
+    // Determine if this table is in the RSDT or XSDT\r
+    //\r
+    if ((CurrentTableSignature == EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) ||\r
+        (CurrentTableSignature == EFI_ACPI_2_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) ||\r
+        (CurrentTableSignature == EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE)\r
+        ) {\r
+      RemoveFromRsdt = FALSE;\r
+    }\r
+    //\r
+    // We don't remove the FADT in the standard way because some\r
+    // OS expect the FADT to be early in the table list.\r
+    // So we always put it as the first element in the list.\r
+    //\r
+    if (CurrentTableSignature == EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {\r
+      RemoveFromRsdt = FALSE;\r
+    }\r
+\r
+    //\r
+    // Remove the table from RSDT and XSDT\r
+    //\r
+\r
     //\r
     // This is a basic table, remove it from any lists and the Rsdt and/or Xsdt\r
     //\r