From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 08D5C20969675 for ; Fri, 11 May 2018 01:47:32 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2018 01:47:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,387,1520924400"; d="scan'208";a="50010325" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga003.jf.intel.com with ESMTP; 11 May 2018 01:47:32 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 11 May 2018 01:47:31 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 11 May 2018 01:47:32 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.79]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.240]) with mapi id 14.03.0319.002; Fri, 11 May 2018 16:47:29 +0800 From: "Zeng, Star" To: "Shia, Cinnamon" , "edk2-devel@lists.01.org" CC: "lersek@redhat.com" , "Huang, Ansen" , "Zeng, Star" Thread-Topic: [PATCH 2/2] MdeModulePkg Variable: Correct the returned EFI_STATUS in the UpdateVariableStore(). Thread-Index: AQHT6N8V3SGoW3lFVk6eS8ehOFPb1qQqMa5g//9+pICAAIbCYA== Date: Fri, 11 May 2018 08:47:27 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BAEB869@shsmsx102.ccr.corp.intel.com> References: <20180511041753.32040-1-cinnamon.shia@hpe.com> <20180511041753.32040-2-cinnamon.shia@hpe.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BAEB841@shsmsx102.ccr.corp.intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 2/2] MdeModulePkg Variable: Correct the returned EFI_STATUS in the UpdateVariableStore(). X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 May 2018 08:47:33 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable My understanding is GetFvbInfoByAddress() is to *Get* something, then EFI_N= OT_FOUND is better. But UpdateVariableStore() is to *Update* something, I think EFI_UNSUPPORTED= is better. Thanks, Star -----Original Message----- From: Shia, Cinnamon [mailto:cinnamon.shia@hpe.com]=20 Sent: Friday, May 11, 2018 4:43 PM To: Zeng, Star ; edk2-devel@lists.01.org Cc: lersek@redhat.com; Huang, Ansen Subject: RE: [PATCH 2/2] MdeModulePkg Variable: Correct the returned EFI_ST= ATUS in the UpdateVariableStore(). Hi Star, Thanks for your comments. About returning EFI_NOT_FOUND for the case (Fvb =3D=3D NULL), the idea is f= rom GetFvbInfoByAddress(). Do you think we should apply the same logic to GetFvbInfoByAddress()? Thanks, Cinnamon Shia -----Original Message----- From: Zeng, Star [mailto:star.zeng@intel.com]=20 Sent: Friday, May 11, 2018 4:37 PM To: Shia, Cinnamon ; edk2-devel@lists.01.org Cc: lersek@redhat.com; Huang, Ansen ; Zeng, Star Subject: RE: [PATCH 2/2] MdeModulePkg Variable: Correct the returned EFI_ST= ATUS in the UpdateVariableStore(). Good patch. I have two minor comments. 1. Please reduce the title length to <=3D 72 chars as I know it is requirem= ent for patch check (PatchCheck.py in BaseTools) and push to server. 2. I prefer to return EFI_UNSUPPORTED instead of EFI_NOT_FOUND for the case= (Fvb =3D=3D NULL). @retval EFI_UNSUPPORTED Fvb is a NULL for Non-Volatile variable up= date. Thanks, Star -----Original Message----- From: cinnamon shia [mailto:cinnamon.shia@hpe.com]=20 Sent: Friday, May 11, 2018 12:18 PM To: edk2-devel@lists.01.org Cc: lersek@redhat.com; Zeng, Star ; cinnamon shia ; Ansen Huang Subject: [PATCH 2/2] MdeModulePkg Variable: Correct the returned EFI_STATUS= in the UpdateVariableStore(). If Fvb is a NULL, EFI_NOT_FOUND should be returned. If the remaining size is not enough, EFI_OUT_OF_RESOURCES should be returne= d. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: cinnamon shia Signed-off-by: Ansen Huang --- MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeMod= ulePkg/Universal/Variable/RuntimeDxe/Variable.c index 7303681aaa..fc10cd9e18 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -238,6 +238,8 @@ IsValidVariableHeader ( @param Buffer Pointer to the buffer from which data is = written. =20 @retval EFI_INVALID_PARAMETER Parameters not valid. + @retval EFI_NOT_FOUND Fvb is a NULL. + @retval EFI_OUT_OF_RESOURCES The remaining size is not enough. @retval EFI_SUCCESS Variable store successfully updated. =20 **/ @@ -274,7 +276,7 @@ UpdateVariableStore ( // if (!Volatile) { if (Fvb =3D=3D NULL) { - return EFI_INVALID_PARAMETER; + return EFI_NOT_FOUND; } Status =3D Fvb->GetPhysicalAddress(Fvb, &FvVolHdr); ASSERT_EFI_ERROR (Status); @@ -289,7 +291,7 @@ UpdateVariableStore ( } =20 if ((DataPtr + DataSize) > ((EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) = FwVolHeader + FwVolHeader->FvLength))) { - return EFI_INVALID_PARAMETER; + return EFI_OUT_OF_RESOURCES; } } else { // @@ -302,7 +304,7 @@ UpdateVariableStore ( } =20 if ((DataPtr + DataSize) > ((UINTN) ((UINT8 *) VolatileBase + Volatile= Base->Size))) { - return EFI_INVALID_PARAMETER; + return EFI_OUT_OF_RESOURCES; } =20 // --=20 2.16.1.windows.4