[edk2-devel] [PATCH] UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build failure

Dong, Eric eric.dong at intel.com
Wed Jul 17 03:26:11 UTC 2019


Reviewed-by: Eric Dong <eric.dong at intel.com>

> -----Original Message-----
> From: Zeng, Star
> Sent: Wednesday, July 17, 2019 11:23 AM
> To: devel at edk2.groups.io
> Cc: Zeng, Star <star.zeng at intel.com>; Laszlo Ersek <lersek at redhat.com>;
> Dong, Eric <eric.dong at intel.com>; Ni, Ray <ray.ni at intel.com>; Bi, Dandan
> <dandan.bi at intel.com>
> Subject: [PATCH] UefiCpuPkg DxeRegisterCpuFeaturesLib: Fix VS2012 build
> failure
> 
> The new VS2012 build failure is caused by 7a0df26.
> 
> xxx\registercpufeatureslib\dxeregistercpufeatureslib.c(258) :
>  warning C4701: potentially uninitialized local variable 'MpEvent' used
> 
> It is a false positive alarm.
> MpEvent is assigned at line 238 and will be used at line 258, both lines are
> controlled by "if (CpuFeaturesData->NumberOfCpus > 1)".
> 
> This patch initializes MpEvent to suppress incorrect compiler/analyzer
> warnings.
> 
> Cc: Laszlo Ersek <lersek at redhat.com>
> Cc: Eric Dong <eric.dong at intel.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Dandan Bi <dandan.bi at intel.com>
> Signed-off-by: Star Zeng <star.zeng at intel.com>
> ---
>  .../RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c      | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
> index ffd99046a6cd..f87b2892aaae 100644
> ---
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c
> +++
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLi
> +++ b.c
> @@ -229,6 +229,12 @@ CpuFeaturesInitialize (
>    OldBspNumber = GetProcessorIndex (CpuFeaturesData);
>    CpuFeaturesData->BspNumber = OldBspNumber;
> 
> +  //
> +  //
> +  // Initialize MpEvent to suppress incorrect compiler/analyzer warnings.
> +  //
> +  MpEvent = NULL;
> +
>    if (CpuFeaturesData->NumberOfCpus > 1) {
>      Status = gBS->CreateEvent (
>                      EVT_NOTIFY_WAIT,
> --
> 2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43838): https://edk2.groups.io/g/devel/message/43838
Mute This Topic: https://groups.io/mt/32499927/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list