From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.43644.1585541770432599692 for ; Sun, 29 Mar 2020 21:16:10 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: jian.j.wang@intel.com) IronPort-SDR: F/MbQ9hR2TnwXJ6fcaSnfQV99HPM+x4nuPmN0Zd5u0vXS0iYm+T8CziHSiIlyIY15RgNI+UDaQ zqo+eBsB8dpg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2020 21:16:10 -0700 IronPort-SDR: fuKaMbb7KiWR372lf4ao+fntRKnrMyWARSzQOGhYPPZryTvgG8cMm9cKUgIbudN8Xigu4Jdx6y vRgP0pV05sEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,322,1580803200"; d="scan'208";a="272244685" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 29 Mar 2020 21:16:10 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 29 Mar 2020 21:16:10 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 29 Mar 2020 21:16:02 -0700 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.191]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.209]) with mapi id 14.03.0439.000; Mon, 30 Mar 2020 12:16:00 +0800 From: "Wang, Jian J" To: "michael.kubacki@outlook.com" , "devel@edk2.groups.io" CC: Bret Barkelew , "Gao, Liming" , "Kinney, Michael D" , "Wu, Hao A" Subject: Re: [PATCH v3 1/3] MdeModulePkg Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL Thread-Topic: [PATCH v3 1/3] MdeModulePkg Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL Thread-Index: AQHWBIKSEMdk6DhAnEKo9ycXVUB4p6hgiqeg Date: Mon, 30 Mar 2020 04:15:59 +0000 Message-ID: References: <20200327215536.9556-1-michael.kubacki@outlook.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: jian.j.wang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jian J Wang Regards, Jian > -----Original Message----- > From: michael.kubacki@outlook.com > Sent: Saturday, March 28, 2020 5:56 AM > To: devel@edk2.groups.io > Cc: Bret Barkelew ; Gao, Liming > ; Kinney, Michael D ; > Wang, Jian J ; Wu, Hao A > Subject: [PATCH v3 1/3] MdeModulePkg Variable: Return GetVariable() attr = if > EFI_BUFFER_TOO_SMALL >=20 > From: Michael Kubacki >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2062 >=20 > The UEFI specification v2.8 Errata A Section 8.2 "GetVariable()" > "Attributes" parameter description states: >=20 > "If not NULL, a pointer to the memory location to return the > attributes bitmask for the variable. See 'Related Definitions.' > If not NULL, then Attributes is set on output both when > EFI_SUCCESS and when EFI_BUFFER_TOO_SMALL is returned." >=20 > The attributes were previously only returned from the implementation > in Variable.c on EFI_SUCCESS. They are now returned on EFI_SUCCESS or > EFI_BUFFER_TOO_SMALL according to spec. >=20 > Cc: Bret Barkelew > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Jian J Wang > Cc: Hao A Wu > Signed-off-by: Michael Kubacki > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 10 > +++++++--- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | > 10 ++++++---- > 2 files changed, 13 insertions(+), 7 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > index d23aea4bc712..1e71fc642c76 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -18,6 +18,8 @@ >=20 > Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
> (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
> +Copyright (c) Microsoft Corporation.
> + > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -2379,9 +2381,6 @@ VariableServiceGetVariable ( > } >=20 > CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr, > mVariableModuleGlobal->VariableGlobal.AuthFormat), VarDataSize); > - if (Attributes !=3D NULL) { > - *Attributes =3D Variable.CurrPtr->Attributes; > - } >=20 > *DataSize =3D VarDataSize; > UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, TRU= E, > FALSE, FALSE, FALSE, &gVariableInfo); > @@ -2395,6 +2394,11 @@ VariableServiceGetVariable ( > } >=20 > Done: > + if (Status =3D=3D EFI_SUCCESS || Status =3D=3D EFI_BUFFER_TOO_SMALL) { > + if (Attributes !=3D NULL && Variable.CurrPtr !=3D NULL) { > + *Attributes =3D Variable.CurrPtr->Attributes; > + } > + } > ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal- > >VariableGlobal.VariableServicesLock); > return Status; > } > diff --git > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > index 2cf0ed32ae55..ca833fb0244d 100644 > --- > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > +++ > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > @@ -14,6 +14,7 @@ > InitCommunicateBuffer() is really function to check the variable data = size. >=20 > Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) Microsoft Corporation.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -642,10 +643,6 @@ FindVariableInRuntimeCache ( > } >=20 > CopyMem (Data, GetVariableDataPtr (RtPtrTrack.CurrPtr, > mVariableAuthFormat), TempDataSize); > - if (Attributes !=3D NULL) { > - *Attributes =3D RtPtrTrack.CurrPtr->Attributes; > - } > - > *DataSize =3D TempDataSize; >=20 > UpdateVariableInfo (VariableName, VendorGuid, RtPtrTrack.Volatil= e, TRUE, > FALSE, FALSE, TRUE, &mVariableInfo); > @@ -661,6 +658,11 @@ FindVariableInRuntimeCache ( > } >=20 > Done: > + if (Status =3D=3D EFI_SUCCESS || Status =3D=3D EFI_BUFFER_TOO_SMALL) { > + if (Attributes !=3D NULL && RtPtrTrack.CurrPtr !=3D NULL) { > + *Attributes =3D RtPtrTrack.CurrPtr->Attributes; > + } > + } > mVariableRuntimeCacheReadLock =3D FALSE; >=20 > return Status; > -- > 2.16.3.windows.1