From c9b094f61029efff45c8d555d3eff6b061f77b8a Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Mon, 9 Oct 2017 13:23:27 +0800 Subject: [PATCH] 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 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong Reviewed-by: Ruiyu Ni Reviewed-by: Hao Wu --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c index ef72b9b45d..94e5ab2c0e 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c @@ -226,12 +226,14 @@ 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); // // Traverse Register Table of this logical processor -- 2.39.2