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 EC5A220969675 for ; Fri, 11 May 2018 01:49:50 -0700 (PDT) Received: from G2W6310.americas.hpqcorp.net (g2w6310.austin.hp.com [16.197.64.52]) (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 3E240139; Fri, 11 May 2018 08:49:50 +0000 (UTC) Received: from G9W8455.americas.hpqcorp.net (2002:10d8:a15e::10d8:a15e) by G2W6310.americas.hpqcorp.net (2002:10c5:4034::10c5:4034) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Fri, 11 May 2018 08:49:28 +0000 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (15.241.52.12) by G9W8455.americas.hpqcorp.net (16.216.161.94) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Fri, 11 May 2018 08:49:28 +0000 Received: from TU4PR8401MB0926.NAMPRD84.PROD.OUTLOOK.COM (10.169.46.148) by TU4PR8401MB1213.NAMPRD84.PROD.OUTLOOK.COM (10.169.48.151) 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:49:26 +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:49:25 +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+AgAAAfvCAAAJVgIAAAFaw Date: Fri, 11 May 2018 08:49:25 +0000 Message-ID: References: <20180511041753.32040-1-cinnamon.shia@hpe.com> <20180511041753.32040-2-cinnamon.shia@hpe.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BAEB841@shsmsx102.ccr.corp.intel.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BAEB869@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BAEB869@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; TU4PR8401MB1213; 7:WkaXUX93GJCpZRdM98VFvgjhJhFmB+bGg0shjRSB2iUnQPNPBzzV1v6uFHELsg7T5a6fREU8VUr7is6RoMe1I0r+j4vcu6TLBGvhy5BnDM4XowWC7R1GsjGJ7R7DmUaabcPPBllZebPuzOjfUpJSfbUGEqXifSbtuskJjmpn3XX1BAoSXkl4ftYe/r8MjF9hHN/3GjlpNV+1GDA6qvWWMRJfl5kBdEh1t+JWnM7OjJdXtvQEU0WaAel3F63KTyvK x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI; SCL:-1; SFV:NSPM; SFS:(10019020)(366004)(39380400002)(39860400002)(396003)(346002)(376002)(13464003)(199004)(189003)(53936002)(55016002)(186003)(15650500001)(9686003)(97736004)(26005)(8676002)(66066001)(68736007)(6246003)(81166006)(478600001)(2900100001)(4326008)(86362001)(102836004)(229853002)(486006)(476003)(11346002)(53546011)(6506007)(446003)(8936002)(59450400001)(5250100002)(54906003)(106356001)(99286004)(81156014)(2501003)(93886005)(105586002)(110136005)(6436002)(74316002)(76176011)(6116002)(7696005)(33656002)(7736002)(3280700002)(25786009)(316002)(14454004)(3660700001)(2906002)(5660300001)(305945005)(3846002); DIR:OUT; SFP:1102; SCL:1; SRVR:TU4PR8401MB1213; 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)(4534165)(4627221)(201703031133081)(201702281549075)(8990040)(5600026)(48565401081)(2017052603328)(7153060)(7193020); SRVR:TU4PR8401MB1213; x-ms-traffictypediagnostic: TU4PR8401MB1213: 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)(3002001)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:TU4PR8401MB1213; BCL:0; PCL:0; RULEID:; SRVR:TU4PR8401MB1213; x-forefront-prvs: 06691A4183 received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: p5h//rRwR0kYRvANIBSnUCgN4GllEgpNU6ai11hlTFuxB/wncOWphopdDqG+y76Zj1WYy5rgFeDatkFHDqrfMWpAS81OE87gKAJhK51IZbFMTgZXaiXfLQqrU41lc8ansA/1zuM/fSLU8cXeMMEVIz0vzxllzY4+9oHMrI+OtqoOA+wiU43j35OXgNFLsD4R spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: f2e01fd3-a90b-47c2-28ef-08d5b71c194c X-MS-Exchange-CrossTenant-Network-Message-Id: f2e01fd3-a90b-47c2-28ef-08d5b71c194c X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2018 08:49:25.2775 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: TU4PR8401MB1213 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:49:51 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Make sense to me. Will address your comments in the patch v2. Thanks, Cinnamon Shia -----Original Message----- From: Zeng, Star [mailto:star.zeng@intel.com]=20 Sent: Friday, May 11, 2018 4:47 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(). 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