summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
diff options
context:
space:
mode:
authorEric Dong <eric.dong@intel.com>2020-01-07 08:38:22 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-01-08 00:32:15 +0000
commit4bb34b6df1c8dbbb0bab65dc1838b8196568aec6 (patch)
treee47cb748c10858814bd31fc33502e6d8eb27c90e /UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
parentcc617b6e1430242f8d042c71c2d923dbc6436a36 (diff)
downloadedk2-4bb34b6df1c8dbbb0bab65dc1838b8196568aec6.tar.gz
edk2-4bb34b6df1c8dbbb0bab65dc1838b8196568aec6.tar.bz2
edk2-4bb34b6df1c8dbbb0bab65dc1838b8196568aec6.zip
Revert "UefiCpuPkg/PiSmmCpuDxeSmm: Fix buffer overflow issue."
This reverts commit 123b720eeb371e0a31eb727bcf59255b584e355f. The commit message for commit 123b720eeb37 is not correct. Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Eric Dong <eric.dong@intel.com>
Diffstat (limited to 'UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c')
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 870250b0c5..f445d7b030 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -137,7 +137,7 @@ ReleaseAllAPs (
{
UINTN Index;
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {
if (IsPresentAp (Index)) {
ReleaseSemaphore (mSmmMpSyncData->CpuData[Index].Run);
}
@@ -170,7 +170,7 @@ AllCpusInSmmWithExceptions (
CpuData = mSmmMpSyncData->CpuData;
ProcessorInfo = gSmmCpuPrivate->ProcessorInfo;
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {
if (!(*(CpuData[Index].Present)) && ProcessorInfo[Index].ProcessorId != INVALID_APIC_ID) {
if (((Exceptions & ARRIVAL_EXCEPTION_DELAYED) != 0) && SmmCpuFeaturesGetSmmRegister (Index, SmmRegSmmDelayed) != 0) {
continue;
@@ -305,7 +305,7 @@ SmmWaitForApArrival (
//
// Send SMI IPIs to bring outside processors in
//
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {
if (!(*(mSmmMpSyncData->CpuData[Index].Present)) && gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId != INVALID_APIC_ID) {
SendSmiIpi ((UINT32)gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId);
}
@@ -361,7 +361,7 @@ WaitForAllAPsNotBusy (
{
UINTN Index;
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {
//
// Ignore BSP and APs which not call in SMM.
//
@@ -608,7 +608,7 @@ BSPHandler (
//
while (TRUE) {
PresentCount = 0;
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {
if (*(mSmmMpSyncData->CpuData[Index].Present)) {
PresentCount ++;
}
@@ -1343,7 +1343,7 @@ InternalSmmStartupAllAPs (
}
CpuCount = 0;
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {
if (IsPresentAp (Index)) {
CpuCount ++;
@@ -1375,13 +1375,13 @@ InternalSmmStartupAllAPs (
// Here code always use AcquireSpinLock instead of AcquireSpinLockOrFail for not
// block mode.
//
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {
if (IsPresentAp (Index)) {
AcquireSpinLock (mSmmMpSyncData->CpuData[Index].Busy);
}
}
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {
if (IsPresentAp (Index)) {
mSmmMpSyncData->CpuData[Index].Procedure = (EFI_AP_PROCEDURE2) Procedure;
mSmmMpSyncData->CpuData[Index].Parameter = ProcedureArguments;