Blob Blame History Raw
commit 50bde98a8268e940c0d072de0546685c5c2f893b
Author:     Robert Moore <Robert.Moore@intel.com>
AuthorDate: Fri Jun 19 09:44:39 2015 -0700
Commit:     Robert Moore <Robert.Moore@intel.com>
CommitDate: Fri Jun 19 09:44:39 2015 -0700

    iASL/Disassembler: Add status checks in the dmtbdump module.
    
    Error checking after calls to AcpiDmDumpTable was inconsistent.
    ACPICA BZ 1169.

diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c
index 4711b68..bb9cf55 100644
--- a/source/common/dmtbdump.c
+++ b/source/common/dmtbdump.c
@@ -208,11 +208,16 @@ AcpiDmDumpRsdp (
     ACPI_TABLE_RSDP         *Rsdp = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table);
     UINT32                  Length = sizeof (ACPI_RSDP_COMMON);
     UINT8                   Checksum;
+    ACPI_STATUS             Status;
 
 
     /* Dump the common ACPI 1.0 portion */
 
-    AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
+    if (ACPI_FAILURE (Status))
+    {
+        return (Length);
+    }
 
     /* Validate the first checksum */
 
@@ -229,7 +234,11 @@ AcpiDmDumpRsdp (
     if (Rsdp->Revision > 0)
     {
         Length = Rsdp->Length;
-        AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
+        Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
+        if (ACPI_FAILURE (Status))
+        {
+            return (Length);
+        }
 
         /* Validate the extended checksum over entire RSDP */
 
@@ -347,37 +356,59 @@ void
 AcpiDmDumpFadt (
     ACPI_TABLE_HEADER       *Table)
 {
+    ACPI_STATUS             Status;
+
 
     /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
 
-    AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
+    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
+    if (ACPI_FAILURE (Status))
+    {
+        return;
+    }
 
     /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
 
     if ((Table->Length > ACPI_FADT_V1_SIZE) &&
         (Table->Length <= ACPI_FADT_V2_SIZE))
     {
-        AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
+        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
+        if (ACPI_FAILURE (Status))
+        {
+            return;
+        }
     }
 
     /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
 
     else if (Table->Length > ACPI_FADT_V2_SIZE)
     {
-        AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
+        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt3);
+        if (ACPI_FAILURE (Status))
+        {
+            return;
+        }
 
         /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
 
         if (Table->Length > ACPI_FADT_V3_SIZE)
         {
-            AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5);
+            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5);
+            if (ACPI_FAILURE (Status))
+            {
+                return;
+            }
         }
 
         /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
 
         if (Table->Length > ACPI_FADT_V3_SIZE)
         {
-            AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6);
+            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6);
+            if (ACPI_FAILURE (Status))
+            {
+                return;
+            }
         }
     }
 
@@ -1136,7 +1167,7 @@ AcpiDmDumpDrtm (
                 AcpiDmTableInfoDrtm1);
     if (ACPI_FAILURE (Status))
     {
-            return;
+        return;
     }
 
     Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources);
@@ -1164,13 +1195,9 @@ AcpiDmDumpDrtm (
 
     DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
     AcpiOsPrintf ("\n");
-    Status = AcpiDmDumpTable (Table->Length, Offset,
+    (void) AcpiDmDumpTable (Table->Length, Offset,
                 DrtmDps, sizeof (ACPI_DRTM_DPS_ID),
                 AcpiDmTableInfoDrtm2);
-    if (ACPI_FAILURE (Status))
-    {
-        return;
-    }
 }
 
 
@@ -1794,6 +1821,10 @@ AcpiDmDumpIort (
                 Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
                             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                             Length, AcpiDmTableInfoIort3a);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
 
                 NodeOffset = IortSmmu->ContextInterruptOffset;
                 for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
@@ -1801,6 +1832,10 @@ AcpiDmDumpIort (
                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
                                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                                 8, AcpiDmTableInfoIort3b);
+                    if (ACPI_FAILURE (Status))
+                    {
+                        return;
+                    }
                     NodeOffset += 8;
                 }
 
@@ -1810,6 +1845,10 @@ AcpiDmDumpIort (
                     Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
                                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                                 8, AcpiDmTableInfoIort3c);
+                    if (ACPI_FAILURE (Status))
+                    {
+                        return;
+                    }
                     NodeOffset += 8;
                 }
             }
@@ -1830,6 +1869,10 @@ AcpiDmDumpIort (
             Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
                         Length, AcpiDmTableInfoIortMap);
+            if (ACPI_FAILURE (Status))
+            {
+                return;
+            }
             NodeOffset += Length;
         }
 
@@ -2004,6 +2047,10 @@ AcpiDmDumpIvrs (
 
                 Status = AcpiDmDumpTable (Table->Length, EntryOffset,
                             DeviceEntry, EntryLength, InfoTable);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
 
                 EntryOffset += EntryLength;
                 DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry,
@@ -2687,6 +2734,11 @@ AcpiDmDumpNfit (
                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
                             &Interleave->LineOffset[i],
                             sizeof (UINT32), AcpiDmTableInfoNfit2a);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
+
                 FieldOffset += sizeof (UINT32);
             }
             break;
@@ -2715,6 +2767,11 @@ AcpiDmDumpNfit (
                 Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
                             &Hint->HintAddress[i],
                             sizeof (UINT64), AcpiDmTableInfoNfit6a);
+                if (ACPI_FAILURE (Status))
+                {
+                    return;
+                }
+
                 FieldOffset += sizeof (UINT64);
             }
             break;
@@ -3126,7 +3183,7 @@ void
 AcpiDmDumpSlic (
     ACPI_TABLE_HEADER       *Table)
 {
-    AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
+    (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
                 Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
 }
 
@@ -3497,10 +3554,6 @@ AcpiDmDumpWpbt (
 
     /* Dump the arguments buffer */
 
-    AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
+    (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
         AcpiDmTableInfoWpbt0);
-    if (ACPI_FAILURE (Status))
-    {
-        return;
-    }
 }