From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.92.23.107]) by mx.groups.io with SMTP id smtpd.web10.24058.1585346181915063483 for ; Fri, 27 Mar 2020 14:56:22 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=ebSpuYZ5; spf=pass (domain: outlook.com, ip: 40.92.23.107, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jiCdSXLcEYSq5l4h6o1z59aoMAoyoCbJ5ieReC0jpNcYs6vQlWPZ1o1NAvzeoVx5dVC6nDVbwsZebOLCxZ25gDpup4mce96U1zLKUGaDWLx762N2hmfGOAabK0SZ4MPjfF+S/lL5Bdp6tBln4t/ER6F8Qv98HSHg5k7KKNRsLjbqVKWBj6Ym3AbRtjuxAblyzXYrkEggQnYSMbqALVQ/X1+Npur4NXTJdWV6trQ8wHf8/qdjEl8HjpAO+7ewhoCz4J88PQLWQDJj8ashzMhnN/9p+wn/puXOhJHPl6o+fN3xUV8Rk5hfJ+B5mHhuaxj8hYowOLEawiRd+eeFNOntog== 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=Kc5k5cPkdhj53/dXWTBfXKMw4H/nEcL0s+O2tCQtih8=; b=Dye9FfYb66Djj5cPL0b0EOk7wgRxFC0IxwGyFl2xF3ob8YkY2hcGVpwqTJRR3q60a+y3PtiDgK8JNJZlKrOn+n6GT+vypgTO6NuH5ha9ZNPqCK54EujbD526xLN9UoUudNS1vXwcYOWW6zHJc5qa1xmL0CrwZn0XW+rBFkhL46TIOdUluAZ8xvlB5UaRq+IS3iNm86jmNkM8ooNBAeh03RacDQ0ljSRPhevqxHvp7HWDdB8JTXKwJ9Q0gfpqEwkWfCyMVNyrNd3cgR++oNRrNH2CTafpZJZt8fPguA6bTgWE4ajBuneg8RZGbS27QkK+QX4tO6DI1pz6nSHDEGMVKA== 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=Kc5k5cPkdhj53/dXWTBfXKMw4H/nEcL0s+O2tCQtih8=; b=ebSpuYZ5yeCf0o5YMHfjxxlDHYrRR0tzbZeNX7MtDeSkOxcKBHjnV0s9o4c1/V28D9NLw6AYTDIs756lWLvMjvfJkOunYI8lBEguXVqhy75uWnhm3bpO8hiIC/c+1DAKrxhsARqe6SQRYlhZsiw4cd8otzMi59ng5D9C7cwsx6L5NlGt04vgYfY9buI4oGXSHE4jDBj0+Pln2GQgfOG6mufc7grbaL/0IJEBGK/gfLLtLuiPV/iHBtKo6bmux7vHOBsZUYZqZQxn++uak3CJhZVOjkrkx7J/eVVXzc9eUNu1ICx1M1XrJbC54Ck/syS4QDY7Wy7XjMveIw6qyw5t7g== Received: from DM6NAM12FT037.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::4f) by DM6NAM12HT106.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::352) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.9; Fri, 27 Mar 2020 21:56:20 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (10.13.178.52) by DM6NAM12FT037.mail.protection.outlook.com (10.13.179.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.9 via Frontend Transport; Fri, 27 Mar 2020 21:56:20 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:78847234962A7F9953BF06D60694F708EAF0223FC02DC9C394E2004F29765702;UpperCasedChecksum:5180ACCC31F870018D2A29A57CB1AB418735F4390656BA38738034C749A110B3;SizeAsReceived:7878;Count:49 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; Fri, 27 Mar 2020 21:56:20 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Bret Barkelew , Liming Gao , Michael D Kinney , Jian J Wang , Hao A Wu Subject: [PATCH v3 2/3] MdeModulePkg VariablePei: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL Date: Fri, 27 Mar 2020 14:55:35 -0700 Message-ID: X-Mailer: git-send-email 2.16.3.windows.1 In-Reply-To: <20200327215536.9556-1-michael.kubacki@outlook.com> References: <20200327215536.9556-1-michael.kubacki@outlook.com> X-ClientProxiedBy: MWHPR20CA0037.namprd20.prod.outlook.com (2603:10b6:300:ed::23) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20200327215536.9556-3-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:a:5a12:4b01:47a7:5411) by MWHPR20CA0037.namprd20.prod.outlook.com (2603:10b6:300:ed::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.19 via Frontend Transport; Fri, 27 Mar 2020 21:56:20 +0000 X-Mailer: git-send-email 2.16.3.windows.1 X-Microsoft-Original-Message-ID: <20200327215536.9556-3-michael.kubacki@outlook.com> X-TMN: [PGXeQU69HemBup8h5zNep0LAWKziTDwySBw3v+KTE+uob3fgOkkdM6gcsKYiMTla] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 1149c2b5-518a-44f1-60fa-08d7d299af33 X-MS-TrafficTypeDiagnostic: DM6NAM12HT106: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d35UoiPg/oN1WeucnRI+4CCBabNLQumOzV1VOeUJ2GBrt4ArFwUXc4wCgmC/95PVUUEVw+++Miuq9kYwS4y8KsxbU0zat/KCJsGX0q366lmLPxXlDkuwd03gZDkTMHlM0GHcol9kbHTSmEeRO7yFWDAIW1uBxRNKZlFe+hE26UI/AxY9MVwPwf7f94viHAiwkDsTLzf6nVwD52mpQsvslro2TzMyz0Izh71HjYm4rlA= X-MS-Exchange-AntiSpam-MessageData: Qt0I4m8u8HgXPSKdhvna1SZbrjSbi5GrzSmYex1sJJ7X89VYChpctqE3mqmMBPLwX5L9mJXjTORu+lcIA+DL4RqMGmD+NhHyIuKf1qPKFfDetGvlTMCiKd8aMCrHA6Vjzxe6e/VdBLcpOhvelYdb8xsUhrvbjjjShuUgJMZPvr4dhhGFl5J2X8LDLhEdPuOZD/PlqAxhgaJQ+3NNPGtXgA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1149c2b5-518a-44f1-60fa-08d7d299af33 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2020 21:56:20.8792 (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: DM6NAM12HT106 Content-Type: text/plain From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2062 This commit makes the behavior for PeiGetVariable() match the following specification-defined behavior. It is now consistent with the DXE/SMM variable driver implementation. 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/Pei/Variable.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c index f61465fc3045..f420b58165b7 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -3,6 +3,7 @@ PEI ReadOnly Varaiable2 PPI. These services operates the non volatile storage space. Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -1047,17 +1048,17 @@ PeiGetVariable ( } GetVariableNameOrData (&StoreInfo, GetVariableDataPtr (Variable.CurrPtr, VariableHeader, StoreInfo.AuthFlag), VarDataSize, Data); - - if (Attributes != NULL) { - *Attributes = VariableHeader->Attributes; - } - - *DataSize = VarDataSize; - return EFI_SUCCESS; + Status = EFI_SUCCESS; } else { - *DataSize = VarDataSize; - return EFI_BUFFER_TOO_SMALL; + Status = EFI_BUFFER_TOO_SMALL; } + + if (Attributes != NULL) { + *Attributes = VariableHeader->Attributes; + } + *DataSize = VarDataSize; + + return Status; } /** -- 2.16.3.windows.1