Current code logic not check the pointer before use it. This may
has potential issue, this patch add code to check it.

Cc: Ruiyu Ni <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <[email protected]>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
index ef72b9b..2c1dc82 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
@@ -226,12 +226,17 @@ SetProcessorRegister (
   CPU_REGISTER_TABLE        *RegisterTable;
 
   InitApicId = GetInitialApicId ();
+  RegisterTable = NULL;
   for (Index = 0; Index < RegisterTableCount; Index++) {
     if (RegisterTables[Index].InitialApicId == InitApicId) {
       RegisterTable =  &RegisterTables[Index];
       break;
     }
   }
+  ASSERT (RegisterTable != NULL);
+  if (RegisterTable == NULL) {
+    return;
+  }
 
   //
   // Traverse Register Table of this logical processor
-- 
2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to