Reviewed-by: Nate DeSimone <nathaniel.l.desim...@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Zhang, Shenglei
Sent: Wednesday, September 11, 2019 8:27 PM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A <michael.a.kuba...@intel.com>; Chiu, Chasel 
<chasel.c...@intel.com>; Desimone, Nathaniel L 
<nathaniel.l.desim...@intel.com>; Gao, Liming <liming....@intel.com>
Subject: [edk2-devel] [PATCH v2 2/2] MinPlatformPkg/AcpiTables: Add error 
handling to SortCpuLocalApicInTable

Change ASSERT_EFI_ERROR to return value when the "if" statement is true.
As a result, when SortCpuLocalApicInTable is called, error handling is needed. 
So add "if" statement to judge the returned Status from SortCpuLocalApicInTable 
() in function InstallMadtFromScratch().

Cc: Michael Kubacki <michael.a.kuba...@intel.com>
Cc: Chasel Chiu <chasel.c...@intel.com>
Cc: Nate DeSimone <nathaniel.l.desim...@intel.com>
Cc: Liming Gao <liming....@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zh...@intel.com>
---
 .../Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index 2cc55ee8..ae25d753 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -354,7 +354,7 @@ SortCpuLocalApicInTable (
 
       if(MAX_CPU_NUM <= Index) {
         DEBUG ((EFI_D_ERROR, "Asserting the SortCpuLocalApicInTable Index 
Bufferflow\n"));
-        ASSERT_EFI_ERROR(EFI_INVALID_PARAMETER);
+        return EFI_INVALID_PARAMETER;
       }
 
       TempVal = mCpuApicIdOrderTable[Index].ApicId;
@@ -874,7 +874,11 @@ InstallMadtFromScratch (
   DetectApicIdMap();
 
   // Call for Local APIC ID Reorder
-  SortCpuLocalApicInTable ();
+  Status = SortCpuLocalApicInTable ();
+  if (EFI_ERROR (Status)) {
+    DEBUG ((EFI_D_ERROR, "SortCpuLocalApicInTable failed: %r\n", Status));
+    goto Done;
+  }
 
   MaxMadtStructCount = (UINT32) (
     MAX_CPU_NUM +    // processor local APIC structures
--
2.18.0.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47196): https://edk2.groups.io/g/devel/message/47196
Mute This Topic: https://groups.io/mt/34111553/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to