From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.92.19.58]) by mx.groups.io with SMTP id smtpd.web12.421.1585674696933135007 for ; Tue, 31 Mar 2020 10:11:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=bHLN46XD; spf=pass (domain: outlook.com, ip: 40.92.19.58, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=coK9x2wM+wkGhyze8a1m2dmyStiqwxx2lhcsqzJg2IXO0oL8BY9W6NbNnPs64Gy8wgigvQACcmtQGTDyM9HuhqrNIb/32MH88jeLWgNVZlcs07XG2A8gyQ3oEwH33UeRVpAEA77uJEnwvZNCUm92xUAR/jqqdxl64AIlM8J2D5aAr5o7A88xbyDKxewBDunB2EhkUsSFcWEwNFt6q6xAe9uxzox7y5Ze6hKVNM1MivYj+o2BYiVxmK75N7kJizkuGA5+F2XidsGAq5zLi+BYlUNatJL4YdsvZ3wW115mGhMrpTBTMcFuO/QOVQa4x7m2YGPEg1Tlvae5GqfuX8Cu7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RHfYdF0Q0GSHBVC5f8nEQRqh8F8g4rEYNLkE74hGqL4=; b=a0rBGjk2jlPacv2R+3RKETCfkDmjlYY6BYrAB+BGez8O4g1/2ijyfAMFy67f7/iAV3YBr/CUd84vHHLk5k5rIuZyL/3XnrrUTAWZSXRDrIghR4OmAJUpwmBjbr5udzDyOtZ/wHTmtY+fuijwdcEv6GeyPBPjkRc0dspsfr6Cihoc5GV+aJmZKi3hSR5c2ClnRA9uUZpA7gU4chTu19HfaRU55x1K7uguu9dJloQY0M9nQgUCphQZ5RSwbh14qPrq6tcglSRnW1ws0AoAs/iZ0U0M2lqAPnuK6l9Thzbm3kae4SI0RFEUL+eRRsvZa1S2poTcgied2L1rzGH6rCat7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RHfYdF0Q0GSHBVC5f8nEQRqh8F8g4rEYNLkE74hGqL4=; b=bHLN46XD4CbZuSFCfTUww0LTe4fhqowE22uBxRFs3VQ2izk4OogwFupd36ApIyNhXsxf1sJfBhE94vi4pHHULZza3DT+UKI2aRCUEfCr3ZEceyJLB5uwLeYK7VFJ1bsPYZ/h+X0qvJsxAYqtoWlZDGE0+dwwEh3296CLyg+7OkvxCekypAOJMQ3iJHNDf46VWeJVJLOUXZc39DIcxKSnomWzLT3fl96bKeFdbW9nS42r/5PtxtO1Q78hEOnzUaegPh44KNv5nGbteEGczG4HML2wi03ydTy9sDkOg+tXcuVhyNZbcyNvM1cxVbr9BxeDhPCguv1sNg9O6CUPKbXWAw== Received: from CO1NAM11FT036.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::4a) by CO1NAM11HT185.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::479) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.19; Tue, 31 Mar 2020 17:11:35 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:3861::53) by CO1NAM11FT036.mail.protection.outlook.com (2a01:111:e400:3861::124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.19 via Frontend Transport; Tue, 31 Mar 2020 17:11:35 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:2EA4CBD47D682E8664569B2DBD5DE23F1EA2B137567F6BEFD0AF2F42C904C1B1;UpperCasedChecksum:4C5E93B80DA2708F2AD05EB26ECCAC839F60146B1744808BBDC6DCCA42EE9BE2;SizeAsReceived:9383;Count:50 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::f5a7:e51b:e22a:959f]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::f5a7:e51b:e22a:959f%7]) with mapi id 15.20.2835.023; Tue, 31 Mar 2020 17:11:35 +0000 Subject: Re: [edk2-devel] [PATCH v3 1/3] MdeModulePkg Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL To: "Jiang, Guomin" , "devel@edk2.groups.io" , "Wang, Jian J" Cc: Bret Barkelew , "Gao, Liming" , "Kinney, Michael D" , "Wu, Hao A" References: <20200327215536.9556-1-michael.kubacki@outlook.com> From: "Michael Kubacki" Message-ID: Date: Tue, 31 Mar 2020 10:11:33 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 In-Reply-To: X-ClientProxiedBy: MW2PR2101CA0009.namprd21.prod.outlook.com (2603:10b6:302:1::22) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <81ce93ec-d9e8-274e-94e2-d3fb8ae2537e@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.124.238.121] (131.107.147.121) by MW2PR2101CA0009.namprd21.prod.outlook.com (2603:10b6:302:1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.1 via Frontend Transport; Tue, 31 Mar 2020 17:11:34 +0000 X-Microsoft-Original-Message-ID: <81ce93ec-d9e8-274e-94e2-d3fb8ae2537e@outlook.com> X-TMN: [ajQCgfl1BSP1aGMF5IN8LZ6rOS6q7uBWYJAdzh9Gol4=] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 1a1ffda9-648a-4bcf-f935-08d7d5969093 X-MS-TrafficTypeDiagnostic: CO1NAM11HT185: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +pZznI7W/KXM1H4DLCVl9P1iXZXE6JKd7AH+PkHSqokLAOEBI3Zm5IX6PLdARc/9FouCQZ3d7/DkOuiX4yqLOeq2WXiWQemOVBqyRAxcQAZbvoGuyqzmOq76UzXMT9yqSy/GNXhznM6OHo3wNjpvFPgSXSaZnNC6aIy7K0vNzc+bL2PDL4tc2+WNu8/j3+BOaSc3fVvxlXUCYXKc66E3S2qoUv7Vn16VY9x9AZCMuPE= X-MS-Exchange-AntiSpam-MessageData: YGpxzUkGFSi1KYT6YzODA5hN6PqNIVoF46dgteDiTRFmeENadEhjF/nTUdVdgHHN2RRLeldkN20gphZnUjTcGuq9DCASZWR9PxY10V5huZn96HOqx63lsSmL6rbEPc9Esq0kc5ELsOJn905ruWs0Yw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a1ffda9-648a-4bcf-f935-08d7d5969093 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2020 17:11:35.6004 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM11HT185 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit That has been spelled incorrectly for about 9 years. The file (like many others) also has other spelling errors such as the following. I suggest this be fixed in a separate commit/series focused on fixing spelling errors. --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -102,7 +102,7 @@ AUTH_VAR_LIB_CONTEXT_OUT mAuthContextOut; This function writes data to the FWH at the correct LBA even if the LBAs are fragmented. - @param Global Pointer to VARAIBLE_GLOBAL structure. + @param Global Pointer to VARIABLE_GLOBAL structure. @param Volatile Point out the Variable is Volatile or Non-Volatile. @param SetByIndex TRUE if target pointer is given as index. FALSE if target pointer is absolute. @@ -504,7 +504,7 @@ InitializeVariableQuota ( @return EFI_SUCCESS Reclaim operation has finished successfully. @return EFI_OUT_OF_RESOURCES No enough memory resources or variable space. - @return Others Unexpect error happened during reclaim operation. + @return Others Unexpected error happened during reclaim operation. **/ EFI_STATUS @@ -2561,7 +2561,7 @@ VariableServiceSetVariable ( } // - // Check for reserverd bit in variable attribute. + // Check for reserved bit in variable attribute. // EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated but we still allow // the delete operation of common authenticated variable at user physical presence. // So leave EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS attribute check to AuthVariableLib @@ -3381,7 +3381,7 @@ ConvertNormalVarStorageToAuthVarStorage ( VARIABLE_HEADER *StartPtr; UINT8 *NextPtr; VARIABLE_HEADER *EndPtr; - UINTN AuthVarStroageSize; + UINTN AuthVarStorageSize; AUTHENTICATED_VARIABLE_HEADER *AuthStartPtr; VARIABLE_STORE_HEADER *AuthVarStorage; On 3/31/2020 1:18 AM, Jiang, Guomin wrote: > There is a spell error in the comments of VariableServiceGetVariable() in Variable.c. > - @return EFI_BUFFER_TO_SMALL DataSize is too small for the result. > + @return EFI_BUFFER_TOO_SMALL DataSize is too small for the result. > > Need create new bugs for it or fix in this comment directly? > >> -----Original Message----- >> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >> Wang, Jian J >> Sent: Monday, March 30, 2020 12:16 PM >> To: michael.kubacki@outlook.com; devel@edk2.groups.io >> Cc: Bret Barkelew ; Gao, Liming >> ; Kinney, Michael D ; >> Wu, Hao A >> Subject: Re: [edk2-devel] [PATCH v3 1/3] MdeModulePkg Variable: Return >> GetVariable() attr if EFI_BUFFER_TOO_SMALL >> >> >> 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 1/3] MdeModulePkg Variable: Return GetVariable() >>> attr if EFI_BUFFER_TOO_SMALL >>> >>> From: Michael Kubacki >>> >>> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2062 >>> >>> The UEFI specification v2.8 Errata A Section 8.2 "GetVariable()" >>> "Attributes" parameter description states: >>> >>> "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." >>> >>> 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. >>> >>> 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/RuntimeDxe/Variable.c | 10 >>> +++++++--- >>> >> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe. >> c | >>> 10 ++++++---- >>> 2 files changed, 13 insertions(+), 7 deletions(-) >>> >>> diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >>> b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >>> index d23aea4bc712..1e71fc642c76 100644 >>> --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >>> +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c >>> @@ -18,6 +18,8 @@ >>> >>> Copyright (c) 2006 - 2020, Intel Corporation. All rights >>> reserved.
>>> (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
>>> +Copyright (c) Microsoft Corporation.
>>> + >>> SPDX-License-Identifier: BSD-2-Clause-Patent >>> >>> **/ >>> @@ -2379,9 +2381,6 @@ VariableServiceGetVariable ( >>> } >>> >>> CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr, >>> mVariableModuleGlobal->VariableGlobal.AuthFormat), VarDataSize); >>> - if (Attributes != NULL) { >>> - *Attributes = Variable.CurrPtr->Attributes; >>> - } >>> >>> *DataSize = VarDataSize; >>> UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, >>> TRUE, FALSE, FALSE, FALSE, &gVariableInfo); @@ -2395,6 +2394,11 @@ >>> VariableServiceGetVariable ( >>> } >>> >>> Done: >>> + if (Status == EFI_SUCCESS || Status == EFI_BUFFER_TOO_SMALL) { >>> + if (Attributes != NULL && Variable.CurrPtr != NULL) { >>> + *Attributes = Variable.CurrPtr->Attributes; >>> + } >>> + } >>> ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal- >>>> VariableGlobal.VariableServicesLock); >>> return Status; >>> } >>> diff --git >>> >> a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDx >> e.c >>> >> b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDx >> e.c >>> index 2cf0ed32ae55..ca833fb0244d 100644 >>> --- >>> >> a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDx >> e.c >>> +++ >>> >> b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDx >> e.c >>> @@ -14,6 +14,7 @@ >>> InitCommunicateBuffer() is really function to check the variable data size. >>> >>> Copyright (c) 2010 - 2019, Intel Corporation. All rights >>> reserved.
>>> +Copyright (c) Microsoft Corporation.
>>> SPDX-License-Identifier: BSD-2-Clause-Patent >>> >>> **/ >>> @@ -642,10 +643,6 @@ FindVariableInRuntimeCache ( >>> } >>> >>> CopyMem (Data, GetVariableDataPtr (RtPtrTrack.CurrPtr, >>> mVariableAuthFormat), TempDataSize); >>> - if (Attributes != NULL) { >>> - *Attributes = RtPtrTrack.CurrPtr->Attributes; >>> - } >>> - >>> *DataSize = TempDataSize; >>> >>> UpdateVariableInfo (VariableName, VendorGuid, >>> RtPtrTrack.Volatile, TRUE, FALSE, FALSE, TRUE, &mVariableInfo); @@ >>> -661,6 +658,11 @@ FindVariableInRuntimeCache ( >>> } >>> >>> Done: >>> + if (Status == EFI_SUCCESS || Status == EFI_BUFFER_TOO_SMALL) { >>> + if (Attributes != NULL && RtPtrTrack.CurrPtr != NULL) { >>> + *Attributes = RtPtrTrack.CurrPtr->Attributes; >>> + } >>> + } >>> mVariableRuntimeCacheReadLock = FALSE; >>> >>> return Status; >>> -- >>> 2.16.3.windows.1 >> >> >> >