From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1D3AF21AE30DB for ; Tue, 18 Sep 2018 09:44:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 920388831E; Tue, 18 Sep 2018 16:44:47 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-209.rdu2.redhat.com [10.10.120.209]) by smtp.corp.redhat.com (Postfix) with ESMTP id 373E11001938; Tue, 18 Sep 2018 16:44:45 +0000 (UTC) To: Jian J Wang , edk2-devel@lists.01.org Cc: Dandan Bi , Hao A Wu , Eric Dong References: <20180918090435.7232-1-jian.j.wang@intel.com> From: Laszlo Ersek Message-ID: Date: Tue, 18 Sep 2018 18:44:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180918090435.7232-1-jian.j.wang@intel.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 18 Sep 2018 16:44:47 +0000 (UTC) Subject: Re: [PATCH v2] UefiCpuPkg/CpuMpPei: fix vs2012 build error X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2018 16:44:48 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 09/18/18 11:04, Jian J Wang wrote: >> 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 > Cc: Hao A Wu > Cc: Eric Dong > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jian J Wang > --- > 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. > // > Reviewed-by: Laszlo Ersek Thanks! Laszlo