UefiCpuPkg/PiSmmCpuDxeSmm: Add check to void use null pointer.

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 <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Eric Dong 2017-10-09 13:23:27 +08:00
parent ab3f3d7027
commit c9b094f610
1 changed files with 2 additions and 0 deletions

View File

@ -226,12 +226,14 @@ SetProcessorRegister (
CPU_REGISTER_TABLE *RegisterTable; CPU_REGISTER_TABLE *RegisterTable;
InitApicId = GetInitialApicId (); InitApicId = GetInitialApicId ();
RegisterTable = NULL;
for (Index = 0; Index < RegisterTableCount; Index++) { for (Index = 0; Index < RegisterTableCount; Index++) {
if (RegisterTables[Index].InitialApicId == InitApicId) { if (RegisterTables[Index].InitialApicId == InitApicId) {
RegisterTable = &RegisterTables[Index]; RegisterTable = &RegisterTables[Index];
break; break;
} }
} }
ASSERT (RegisterTable != NULL);
// //
// Traverse Register Table of this logical processor // Traverse Register Table of this logical processor