public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2] UefiCpuPkg/CpuMpPei: fix vs2012 build error
@ 2018-09-18  9:04 Jian J Wang
  2018-09-18 16:44 ` Laszlo Ersek
  2018-09-19  1:03 ` Dong, Eric
  0 siblings, 2 replies; 3+ messages in thread
From: Jian J Wang @ 2018-09-18  9:04 UTC (permalink / raw)
  To: edk2-devel; +Cc: Dandan Bi, Hao A Wu, Eric Dong, Laszlo Ersek

> v2 changes:
>   Incorpate Laszlo's reivew comments
>   a. change title
>   b. drop unrelated changes
>   c. remove error message

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1166

Visual Studio 2012 will complain uninitialized variable, StackBase,
in the CpuPaging.c. This patch adds code to init it to zero and
ASSERT check against 0. This is enough since uninit case will only
happen during retrieving stack memory via gEfiHobMemoryAllocStackGuid.
But this HOB will always be created in advance.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
 UefiCpuPkg/CpuMpPei/CpuPaging.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/UefiCpuPkg/CpuMpPei/CpuPaging.c b/UefiCpuPkg/CpuMpPei/CpuPaging.c
index bcb942a8e5..c7e0822452 100644
--- a/UefiCpuPkg/CpuMpPei/CpuPaging.c
+++ b/UefiCpuPkg/CpuMpPei/CpuPaging.c
@@ -554,6 +554,8 @@ SetupStackGuardPage (
   MpInitLibGetNumberOfProcessors(&NumberOfProcessors, NULL);
   MpInitLibWhoAmI (&Bsp);
   for (Index = 0; Index < NumberOfProcessors; ++Index) {
+    StackBase = 0;
+
     if (Index == Bsp) {
       Hob.Raw = GetHobList ();
       while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, Hob.Raw)) != NULL) {
@@ -570,6 +572,7 @@ SetupStackGuardPage (
       //
       MpInitLibStartupThisAP(GetStackBase, Index, NULL, 0, (VOID *)&StackBase, NULL);
     }
+    ASSERT (StackBase != 0);
     //
     // Set Guard page at stack base address.
     //
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-19  1:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-18  9:04 [PATCH v2] UefiCpuPkg/CpuMpPei: fix vs2012 build error Jian J Wang
2018-09-18 16:44 ` Laszlo Ersek
2018-09-19  1:03 ` Dong, Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox