* [PATCH 1/2] Revert "UefiCpuPkg/PiSmmCpuDxeSmm: Fix buffer overflow issue."
2020-01-07 0:53 [PATCH 0/2] Correct the commit message Dong, Eric
@ 2020-01-07 0:53 ` Dong, Eric
2020-01-07 0:53 ` [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: improve the coding style Dong, Eric
2020-01-07 9:09 ` [PATCH 0/2] Correct the commit message Laszlo Ersek
2 siblings, 0 replies; 4+ messages in thread
From: Dong, Eric @ 2020-01-07 0:53 UTC (permalink / raw)
To: devel; +Cc: Ray Ni, Laszlo Ersek
This reverts commit 123b720eeb371e0a31eb727bcf59255b584e355f.
The commit message for commit 123b720eeb37 is not correct.
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 16 ++++++++--------
1 file 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;
--
2.23.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: improve the coding style
2020-01-07 0:53 [PATCH 0/2] Correct the commit message Dong, Eric
2020-01-07 0:53 ` [PATCH 1/2] Revert "UefiCpuPkg/PiSmmCpuDxeSmm: Fix buffer overflow issue." Dong, Eric
@ 2020-01-07 0:53 ` Dong, Eric
2020-01-07 9:09 ` [PATCH 0/2] Correct the commit message Laszlo Ersek
2 siblings, 0 replies; 4+ messages in thread
From: Dong, Eric @ 2020-01-07 0:53 UTC (permalink / raw)
To: devel; +Cc: Laszlo Ersek, Ray Ni
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2434
Current code use below loops to enumerate the CPUs:
for (Index = mMaxNumberOfCpus; Index-- > 0;) {
it has no issue but not easy for the developers to read the code.
Update above code to below style,
for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
It make the developers easy to read and consistent with other
similar cases in this driver.
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index f445d7b030..35a6996ba3 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -1,7 +1,7 @@
/** @file
SMM MP service implementation
-Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -137,7 +137,7 @@ ReleaseAllAPs (
{
UINTN Index;
- for (Index = mMaxNumberOfCpus; Index-- > 0;) {
+ for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
if (IsPresentAp (Index)) {
ReleaseSemaphore (mSmmMpSyncData->CpuData[Index].Run);
}
@@ -170,7 +170,7 @@ AllCpusInSmmWithExceptions (
CpuData = mSmmMpSyncData->CpuData;
ProcessorInfo = gSmmCpuPrivate->ProcessorInfo;
- for (Index = mMaxNumberOfCpus; Index-- > 0;) {
+ for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
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 = mMaxNumberOfCpus; Index-- > 0;) {
+ for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
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 = mMaxNumberOfCpus; Index-- > 0;) {
+ for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
//
// Ignore BSP and APs which not call in SMM.
//
@@ -608,7 +608,7 @@ BSPHandler (
//
while (TRUE) {
PresentCount = 0;
- for (Index = mMaxNumberOfCpus; Index-- > 0;) {
+ for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
if (*(mSmmMpSyncData->CpuData[Index].Present)) {
PresentCount ++;
}
@@ -1343,7 +1343,7 @@ InternalSmmStartupAllAPs (
}
CpuCount = 0;
- for (Index = mMaxNumberOfCpus; Index-- > 0;) {
+ for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
if (IsPresentAp (Index)) {
CpuCount ++;
@@ -1375,13 +1375,13 @@ InternalSmmStartupAllAPs (
// Here code always use AcquireSpinLock instead of AcquireSpinLockOrFail for not
// block mode.
//
- for (Index = mMaxNumberOfCpus; Index-- > 0;) {
+ for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
if (IsPresentAp (Index)) {
AcquireSpinLock (mSmmMpSyncData->CpuData[Index].Busy);
}
}
- for (Index = mMaxNumberOfCpus; Index-- > 0;) {
+ for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
if (IsPresentAp (Index)) {
mSmmMpSyncData->CpuData[Index].Procedure = (EFI_AP_PROCEDURE2) Procedure;
mSmmMpSyncData->CpuData[Index].Parameter = ProcedureArguments;
--
2.23.0.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Correct the commit message.
2020-01-07 0:53 [PATCH 0/2] Correct the commit message Dong, Eric
2020-01-07 0:53 ` [PATCH 1/2] Revert "UefiCpuPkg/PiSmmCpuDxeSmm: Fix buffer overflow issue." Dong, Eric
2020-01-07 0:53 ` [PATCH 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: improve the coding style Dong, Eric
@ 2020-01-07 9:09 ` Laszlo Ersek
2 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2020-01-07 9:09 UTC (permalink / raw)
To: Eric Dong, devel; +Cc: Ray Ni
On 01/07/20 01:53, Eric Dong wrote:
> This patch serial used to update the commit message.
>
> Rollback the old change and resend it with new commit message.
>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Eric Dong (2):
> Revert "UefiCpuPkg/PiSmmCpuDxeSmm: Fix buffer overflow issue."
> UefiCpuPkg/PiSmmCpuDxeSmm: improve the coding style
>
> UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
series
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Thank you very much, Eric!
Laszlo
^ permalink raw reply [flat|nested] 4+ messages in thread