Blob Blame History Raw
Signed-off-by: Dean Nelson <dnelson@redhat.com>
---
 source/common/dmtbdump1.c |   29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

Index: acpica-unix2-20210604/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20210604/source/common/dmtbdump1.c
@@ -242,20 +242,23 @@ AcpiDmDumpCedt (
 {
     ACPI_STATUS             Status;
     ACPI_CEDT_HEADER        *Subtable;
-    UINT32                  Length = Table->Length;
+    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
     UINT32                  Offset = sizeof (ACPI_TABLE_CEDT);
+    UINT16                  SubtableLength;
 
 
     /* There is no main table (other than the standard ACPI header) */
 
     Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Table, Offset);
-    while (Offset < Table->Length)
+    while (Offset < TableLength)
     {
         /* Common subtable header */
 
+        SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
+
         AcpiOsPrintf ("\n");
-        Status = AcpiDmDumpTable (Length, Offset, Subtable,
-            Subtable->Length, AcpiDmTableInfoCedtHdr);
+        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+            SubtableLength, AcpiDmTableInfoCedtHdr);
         if (ACPI_FAILURE (Status))
         {
             return;
@@ -264,8 +267,8 @@ AcpiDmDumpCedt (
         switch (Subtable->Type)
         {
         case ACPI_CEDT_TYPE_CHBS:
-            Status = AcpiDmDumpTable (Length, Offset, Subtable,
-                Subtable->Length, AcpiDmTableInfoCedt0);
+            Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+                SubtableLength, AcpiDmTableInfoCedt0);
             if (ACPI_FAILURE (Status)) {
                 return;
             }
@@ -277,8 +280,8 @@ AcpiDmDumpCedt (
 
             /* print out table with first "Interleave target" */
 
-            Status = AcpiDmDumpTable (Length, Offset, Subtable,
-                Subtable->Length, AcpiDmTableInfoCedt1);
+            Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+                SubtableLength, AcpiDmTableInfoCedt1);
             if (ACPI_FAILURE (Status)) {
                 return;
             }
@@ -288,8 +291,8 @@ AcpiDmDumpCedt (
             for (i = 1; i < max; i++) {
                 unsigned int loc_offset = Offset + (i * 4) + ACPI_OFFSET(ACPI_CEDT_CFMWS, InterleaveTargets);
                 unsigned int *trg = &(ptr->InterleaveTargets[i]);
-                Status = AcpiDmDumpTable (Length, loc_offset, trg,
-                        Subtable->Length, AcpiDmTableInfoCedt1_te);
+                Status = AcpiDmDumpTable (TableLength, loc_offset, trg,
+                        SubtableLength, AcpiDmTableInfoCedt1_te);
                 if (ACPI_FAILURE (Status)) {
                     return;
                 }
@@ -302,7 +305,7 @@ AcpiDmDumpCedt (
                 Subtable->Type);
 
             /* Attempt to continue */
-            if (!Subtable->Length)
+            if (!SubtableLength)
             {
                 AcpiOsPrintf ("Invalid zero length subtable\n");
                 return;
@@ -310,9 +313,9 @@ AcpiDmDumpCedt (
         }
 
         /* Point to next subtable */
-        Offset += Subtable->Length;
+        Offset += SubtableLength;
         Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Subtable,
-            Subtable->Length);
+            SubtableLength);
     }
 }