From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: liming.gao@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Fri, 23 Aug 2019 06:50:49 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2019 06:50:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,421,1559545200"; d="scan'208";a="208550877" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 23 Aug 2019 06:50:49 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 23 Aug 2019 06:50:49 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 23 Aug 2019 06:50:48 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.250]) with mapi id 14.03.0439.000; Fri, 23 Aug 2019 21:50:46 +0800 From: "Liming Gao" To: Sami Mujawar , "devel@edk2.groups.io" CC: "Alexei.Fedorov@arm.com" , "ard.biesheuvel@linaro.org" , "leif.lindholm@linaro.org" , "Matteo.Carlini@arm.com" , "Kinney, Michael D" , "nd@arm.com" Subject: Re: [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use Thread-Topic: [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use Thread-Index: AQHVWaG+gceoG3WlRk+GWVD8lmmeoacIv3xg Date: Fri, 23 Aug 2019 13:50:45 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E4DB949@SHSMSX104.ccr.corp.intel.com> References: <20190823105539.13260-1-sami.mujawar@arm.com> <20190823105539.13260-20-sami.mujawar@arm.com> In-Reply-To: <20190823105539.13260-20-sami.mujawar@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2VjOWZlNWUtMDRkYy00YjRmLWEwOWUtYTNkMzEyMTdjYWE1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoieWpqQUlodUpXenlJdU5aQlJ4eHQ0ZWFBVkx0elk1OURTbkpkR0NKN1prY3NIczZkcEFvVURzVXFaVnVPNXMxcSJ9 dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Is this warning reported on ARM arch? In Base.h, VA_START is defined as below for ARM arch. Do you mean VS2017 re= port the warning for below macro?=20 If so, can you propose the change in VA_START macro to fix this warning, th= en doesn't need to update consumer source code.=20 #define VA_START(Marker, Parameter) __va_start (&Marker, &Parameter, _I= NT_SIZE_OF (Parameter), __alignof(Parameter), &Parameter) > -----Original Message----- > From: Sami Mujawar [mailto:sami.mujawar@arm.com] > Sent: Friday, August 23, 2019 6:56 PM > To: devel@edk2.groups.io > Cc: Sami Mujawar ; Alexei.Fedorov@arm.com; ard.bies= heuvel@linaro.org; leif.lindholm@linaro.org; > Matteo.Carlini@arm.com; Kinney, Michael D ; G= ao, Liming ; nd@arm.com > Subject: [PATCH v1 19/19] MdePkg: Initialise VA_LIST variables before use >=20 > The VS2017 compiler reports 'warning C6001: Using > uninitialized memory 'Marker'.' for VA_LIST > variables. >=20 > To fix this issue declare a VA_LIST global variable > and use this to initialise VA_LIST variables before > use. >=20 > Note: The VA_LIST cannot be assigned a NULL value > because some compilers define VA_LIST to be a > structure. >=20 > Signed-off-by: Sami Mujawar > --- > MdePkg/Library/BaseLib/SwitchStack.c | 9 +++++++++ > MdePkg/Library/BasePrintLib/PrintLib.c | 5 +++++ > MdePkg/Library/BasePrintLib/PrintLibInternal.c | 9 +++++++++ > 3 files changed, 23 insertions(+) >=20 > diff --git a/MdePkg/Library/BaseLib/SwitchStack.c b/MdePkg/Library/BaseLi= b/SwitchStack.c > index cb9f69f1eaceba690b48e9ca6b8a9af2e348bddd..e1bb524819b3de3521c5461ce= 681aa3a6c186f2c 100644 > --- a/MdePkg/Library/BaseLib/SwitchStack.c > +++ b/MdePkg/Library/BaseLib/SwitchStack.c > @@ -2,12 +2,20 @@ > Switch Stack functions. >=20 > Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> + Copyright (c) 2019, ARM Ltd. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ >=20 > #include "BaseLibInternals.h" >=20 > +// > +// Declare a VA_LIST global variable that is used to initialise VA_LIST > +// variables before use. The VA_LIST cannot be assigned a NULL value > +// because some compilers define VA_LIST to be a structure. > +// > +STATIC VA_LIST gNullVaList; > + > /** > Transfers control to a function starting with a new stack. >=20 > @@ -57,6 +65,7 @@ SwitchStack ( > // > ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) =3D=3D 0); >=20 > + Marker =3D gNullVaList; > VA_START (Marker, NewStack); >=20 > InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker)= ; > diff --git a/MdePkg/Library/BasePrintLib/PrintLib.c b/MdePkg/Library/Base= PrintLib/PrintLib.c > index af771652e4b0aebd616973ba1089ae5bc2b6f0c0..67c5f3dd547cea5447075ef88= d697879883ba5ab 100644 > --- a/MdePkg/Library/BasePrintLib/PrintLib.c > +++ b/MdePkg/Library/BasePrintLib/PrintLib.c > @@ -3,6 +3,7 @@ >=20 > Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved. > + Copyright (c) 2019, ARM Ltd. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -177,6 +178,7 @@ UnicodeSPrint ( > VA_LIST Marker; > UINTN NumberOfPrinted; >=20 > + Marker =3D gNullVaList; > VA_START (Marker, FormatString); > NumberOfPrinted =3D UnicodeVSPrint (StartOfBuffer, BufferSize, FormatS= tring, Marker); > VA_END (Marker); > @@ -337,6 +339,7 @@ UnicodeSPrintAsciiFormat ( > VA_LIST Marker; > UINTN NumberOfPrinted; >=20 > + Marker =3D gNullVaList; > VA_START (Marker, FormatString); > NumberOfPrinted =3D UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSi= ze, FormatString, Marker); > VA_END (Marker); > @@ -614,6 +617,7 @@ AsciiSPrint ( > VA_LIST Marker; > UINTN NumberOfPrinted; >=20 > + Marker =3D gNullVaList; > VA_START (Marker, FormatString); > NumberOfPrinted =3D AsciiVSPrint (StartOfBuffer, BufferSize, FormatStr= ing, Marker); > VA_END (Marker); > @@ -774,6 +778,7 @@ AsciiSPrintUnicodeFormat ( > VA_LIST Marker; > UINTN NumberOfPrinted; >=20 > + Marker =3D gNullVaList; > VA_START (Marker, FormatString); > NumberOfPrinted =3D AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSi= ze, FormatString, Marker); > VA_END (Marker); > diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Libr= ary/BasePrintLib/PrintLibInternal.c > index b6ec5ac4fbb98982f8ccaf3908c2a91ce583e31e..11392f2a5d12eb059611c3ff7= 7b27b602f9b9a40 100644 > --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c > +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c > @@ -2,12 +2,20 @@ > Print Library internal worker functions. >=20 > Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> + Copyright (c) 2019, ARM Ltd. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ >=20 > #include "PrintLibInternal.h" >=20 > +// > +// Declare a VA_LIST global variable that is used to initialise VA_LIST > +// variables before use. The VA_LIST cannot be assigned a NULL value > +// because some compilers define VA_LIST to be a structure. > +// > +extern VA_LIST gNullVaList; > + > #define WARNING_STATUS_NUMBER 5 > #define ERROR_STATUS_NUMBER 33 >=20 > @@ -1256,6 +1264,7 @@ BasePrintLibSPrint ( > VA_LIST Marker; > UINTN NumberOfPrinted; >=20 > + Marker =3D gNullVaList; > VA_START (Marker, FormatString); > NumberOfPrinted =3D BasePrintLibSPrintMarker (StartOfBuffer, BufferSiz= e, Flags, FormatString, Marker, NULL); > VA_END (Marker); > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20