UefiCpuPkg RegisterCpuFeaturesLib: NumberOfCpus may be uninitialized
NumberOfCpus local variable in GetAcpiCpuData will be uninitialized when CpuS3DataDxe runs before DxeRegisterCpuFeaturesLib (linked by CpuFeaturesDxe) because there is no code to initialize it at (AcpiCpuData != NULL) execution path. The issue is exposed aftercefad282fband38ee7bafa7. There was negligence in that code review. One further topic may be "Could EDK2 CI be enhanced to catch this kind of uninitialized local variable case?". :) This patch fixes this regression issue. Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Star Zeng <star.zeng@intel.com> Message-Id: <20210121093944.1621-1-star.zeng@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
@@ -957,6 +957,7 @@ GetAcpiCpuData (
|
|||||||
//
|
//
|
||||||
// Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable for all CPUs
|
// Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable for all CPUs
|
||||||
//
|
//
|
||||||
|
NumberOfCpus = AcpiCpuData->NumberOfCpus;
|
||||||
TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);
|
TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);
|
||||||
RegisterTable = AllocatePages (EFI_SIZE_TO_PAGES (TableSize));
|
RegisterTable = AllocatePages (EFI_SIZE_TO_PAGES (TableSize));
|
||||||
ASSERT (RegisterTable != NULL);
|
ASSERT (RegisterTable != NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user