From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.43707.1585541946618440062 for ; Sun, 29 Mar 2020 21:19:06 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: jian.j.wang@intel.com) IronPort-SDR: XZMEvSy/aenvzdqNStnJAIsbsaVlgpgNeTFAg2etVqjH44EjbBY6YWIvTwNIhMLAUl/X30DcSp W+VK68ty7sAA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Mar 2020 21:19:06 -0700 IronPort-SDR: /Sza3g2ejVbBR1ww43zKWFC42PigG+ZhVijmymoiiUBgPvxUn+rxKCA0fbOG2jsaux5PmMZPJ4 +dJvjtOm2gOQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,322,1580803200"; d="scan'208";a="272245057" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 29 Mar 2020 21:19:06 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) 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:19:06 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 29 Mar 2020 21:19:05 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 29 Mar 2020 21:19:05 -0700 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.191]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.129]) with mapi id 14.03.0439.000; Mon, 30 Mar 2020 12:19:03 +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 2/3] MdeModulePkg VariablePei: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL Thread-Topic: [PATCH v3 2/3] MdeModulePkg VariablePei: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL Thread-Index: AQHWBIKScYFXpbjwLUGosDGuqzla0qhgi6Cg Date: Mon, 30 Mar 2020 04:19:02 +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 2/3] MdeModulePkg VariablePei: Return GetVariable() at= tr if > EFI_BUFFER_TOO_SMALL >=20 > From: Michael Kubacki >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2062 >=20 > This commit makes the behavior for PeiGetVariable() match the following > specification-defined behavior. It is now consistent with the DXE/SMM > variable driver implementation. >=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/Pei/Variable.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c > b/MdeModulePkg/Universal/Variable/Pei/Variable.c > index f61465fc3045..f420b58165b7 100644 > --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c > +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c > @@ -3,6 +3,7 @@ > PEI ReadOnly Varaiable2 PPI. These services operates the non volatile = storage > space. >=20 > Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) Microsoft Corporation.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -1047,17 +1048,17 @@ PeiGetVariable ( > } >=20 > GetVariableNameOrData (&StoreInfo, GetVariableDataPtr (Variable.Curr= Ptr, > VariableHeader, StoreInfo.AuthFlag), VarDataSize, Data); > - > - if (Attributes !=3D NULL) { > - *Attributes =3D VariableHeader->Attributes; > - } > - > - *DataSize =3D VarDataSize; > - return EFI_SUCCESS; > + Status =3D EFI_SUCCESS; > } else { > - *DataSize =3D VarDataSize; > - return EFI_BUFFER_TOO_SMALL; > + Status =3D EFI_BUFFER_TOO_SMALL; > } > + > + if (Attributes !=3D NULL) { > + *Attributes =3D VariableHeader->Attributes; > + } > + *DataSize =3D VarDataSize; > + > + return Status; > } >=20 > /** > -- > 2.16.3.windows.1