From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=15.241.140.78; helo=g4t3425.houston.hpe.com; envelope-from=cinnamon.shia@hpe.com; receiver=edk2-devel@lists.01.org Received: from g4t3425.houston.hpe.com (g4t3425.houston.hpe.com [15.241.140.78]) (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 40A8620969672 for ; Fri, 11 May 2018 01:43:32 -0700 (PDT) Received: from G9W8456.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.161.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g4t3425.houston.hpe.com (Postfix) with ESMTPS id 0C63F137; Fri, 11 May 2018 08:43:31 +0000 (UTC) Received: from G9W8453.americas.hpqcorp.net (2002:10d8:a0d3::10d8:a0d3) by G9W8456.americas.hpqcorp.net (2002:10d8:a15f::10d8:a15f) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Fri, 11 May 2018 08:43:12 +0000 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (15.241.52.13) by G9W8453.americas.hpqcorp.net (16.216.160.211) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Fri, 11 May 2018 08:43:12 +0000 Received: from TU4PR8401MB0926.NAMPRD84.PROD.OUTLOOK.COM (10.169.46.148) by TU4PR8401MB1229.NAMPRD84.PROD.OUTLOOK.COM (10.169.49.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Fri, 11 May 2018 08:43:10 +0000 Received: from TU4PR8401MB0926.NAMPRD84.PROD.OUTLOOK.COM ([fe80::1d68:ebe0:656b:708d]) by TU4PR8401MB0926.NAMPRD84.PROD.OUTLOOK.COM ([fe80::1d68:ebe0:656b:708d%18]) with mapi id 15.20.0755.012; Fri, 11 May 2018 08:43:10 +0000 From: "Shia, Cinnamon" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "lersek@redhat.com" , "Huang, Ansen" Thread-Topic: [PATCH 2/2] MdeModulePkg Variable: Correct the returned EFI_STATUS in the UpdateVariableStore(). Thread-Index: AQHT6N8epfrd7s3ESk2sF2SV7fbdRKQqNM+AgAAAfvA= Date: Fri, 11 May 2018 08:43:09 +0000 Message-ID: References: <20180511041753.32040-1-cinnamon.shia@hpe.com> <20180511041753.32040-2-cinnamon.shia@hpe.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BAEB841@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BAEB841@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=cinnamon.shia@hpe.com; x-originating-ip: [124.155.180.249] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; TU4PR8401MB1229; 7:Sd841QbU+KGTL4xMkIkWQpGK2lO68F+GxuKikC4Sj1u2XZVXP9DgHZtqJMUYDLqL60XWg3lKx2mOGg5oh8UQXu9ifOuGH20zsDr82hk0fTi2P2pxfR5WGBnBB9g6kX722DWwPBYoAk0nrS+Ty449GMASPO3dylymupw3FTTu6bXlX9VUUqFc0NIQUjuWOiHTJ393pf22huThfV8A/aIcBWaV8wDug+L2L0lNukjxXcJYZqjfMAWulfZcasqLm6FM x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(366004)(396003)(39860400002)(376002)(346002)(39380400002)(13464003)(199004)(189003)(2501003)(316002)(76176011)(229853002)(53546011)(7736002)(7696005)(81156014)(81166006)(9686003)(25786009)(6246003)(8676002)(5660300001)(8936002)(53936002)(99286004)(486006)(4326008)(59450400001)(68736007)(186003)(446003)(305945005)(86362001)(476003)(110136005)(6436002)(74316002)(54906003)(26005)(102836004)(11346002)(5250100002)(6506007)(15650500001)(33656002)(2906002)(3660700001)(97736004)(3280700002)(2900100001)(66066001)(14454004)(106356001)(105586002)(478600001)(55016002)(6116002)(3846002); DIR:OUT; SFP:1102; SCL:1; SRVR:TU4PR8401MB1229; H:TU4PR8401MB0926.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:(222181515654134); BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989080)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(8990040)(48565401081)(2017052603328)(7153060)(7193020); SRVR:TU4PR8401MB1229; x-ms-traffictypediagnostic: TU4PR8401MB1229: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(222181515654134)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:TU4PR8401MB1229; BCL:0; PCL:0; RULEID:; SRVR:TU4PR8401MB1229; x-forefront-prvs: 06691A4183 received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: UoNRmtkjk+1JKb27JGLCzDlat1ie4N2BeE8CWoGOvryUqEdI3b/6/wVfukrRZVg57+fXbXx+e9dY8pKuSEUPAMe4wNDoQue7Ibco5fhdru37SvTH1B2BahIriSEVIPMZekmemjWoLzxCZgpQbK9Rkg0c5B1hTSZPj0PTZVI3oH25C9VORdIlD80nd0RzleAV spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: ccccc848-af8e-4361-05de-08d5b71b399f X-MS-Exchange-CrossTenant-Network-Message-Id: ccccc848-af8e-4361-05de-08d5b71b399f X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2018 08:43:10.0266 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: TU4PR8401MB1229 X-OriginatorOrg: hpe.com 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:43:32 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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