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 BDBEC20969643 for ; Fri, 11 May 2018 01:37:24 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2018 01:37:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,387,1520924400"; d="scan'208";a="53397696" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 11 May 2018 01:37:24 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 11 May 2018 01:37:24 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 11 May 2018 01:37:23 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.79]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.179]) with mapi id 14.03.0319.002; Fri, 11 May 2018 16:37:21 +0800 From: "Zeng, Star" To: cinnamon shia , "edk2-devel@lists.01.org" CC: "lersek@redhat.com" , Ansen Huang , "Zeng, Star" Thread-Topic: [PATCH 2/2] MdeModulePkg Variable: Correct the returned EFI_STATUS in the UpdateVariableStore(). Thread-Index: AQHT6N8V3SGoW3lFVk6eS8ehOFPb1qQqMa5g Date: Fri, 11 May 2018 08:37:21 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BAEB841@shsmsx102.ccr.corp.intel.com> References: <20180511041753.32040-1-cinnamon.shia@hpe.com> <20180511041753.32040-2-cinnamon.shia@hpe.com> In-Reply-To: <20180511041753.32040-2-cinnamon.shia@hpe.com> 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:37:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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