REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1280

When copying IDT table in SecMain, the pointer might be
NULL so added the check to fix it.

Test: Verified on internal platform and boots successfully.

Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Desimone Nathaniel L <nathaniel.l.desim...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.c...@intel.com>
---
 IntelFsp2Pkg/FspSecCore/SecMain.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c 
b/IntelFsp2Pkg/FspSecCore/SecMain.c
index f319c68cc5..aed8893ff0 100644
--- a/IntelFsp2Pkg/FspSecCore/SecMain.c
+++ b/IntelFsp2Pkg/FspSecCore/SecMain.c
@@ -113,8 +113,14 @@ SecStartup (
       // ERROR: IDT table size from boot loader is larger than FSP can 
support, DeadLoop here!
       //
       CpuDeadLoop();
+    } else if (IdtDescriptor.Base == 0)  {
+      //
+      // ERROR: IDT table Base should not be zero, DeadLoop here!
+      //
+      CpuDeadLoop();
+    } else {
+      CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) 
IdtDescriptor.Base, IdtSize);
     }
-    CopyMem ((VOID *) (UINTN) &IdtTableInStack.IdtTable, (VOID *) 
IdtDescriptor.Base, IdtSize);
   }
   IdtDescriptor.Base  = (UINTN) &IdtTableInStack.IdtTable;
   IdtDescriptor.Limit = (UINT16)(IdtSize - 1);
-- 
2.13.3.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to