From nobody Thu May 2 04:52:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+62327+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+62327+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1594350300; cv=none; d=zohomail.com; s=zohoarc; b=kcBzmT6pmspUNeEniCz8jr6EkOqY4PcqVFCbEPLxreF9n23wobJa6jmBgpTnwhpSpcL9+ZC9lV4IqlwgpWQhXK/uT9GSIM0/ZQLmI9JBoHJLCQeLuWrOrKFFlzP9jeSp7U+1BPl5TDZ23hgpKROD2cY0mV+5JM9t/WmswVRPKHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594350300; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=S0v/S8gk0+eeCRc6CRfyAlK4VanoVRBoQnh2kI3pemY=; b=LrDFdNm57z7jqw47XH2IMXcAEK5OpV5MzfyWfH47K8Kn4FUCaeWjk2P2h+AH7qO0OL320tcWdhl8WQBf6MS/GSUuSUjQGIYyQAGdFG77kwrMG7jUGJkCBaNhkM9QHYQtqCZKSSgKEFKsVaGlDn5jaxhjyz0XR1+XZy1TRKOtcU8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+62327+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1594350300448827.2555266494736; Thu, 9 Jul 2020 20:05:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id axdIYY1788612xKjKSANonYa; Thu, 09 Jul 2020 20:04:59 -0700 X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web12.3222.1594350298526161609 for ; Thu, 09 Jul 2020 20:04:59 -0700 IronPort-SDR: 7BikDhoDMa4zYkJJKCXmxY1AUFCsQw52aY/evWcnfCT3spZ93M/6BpsgYzxDs2DUU3eTqdGzn0 1YLW1TU2aMqw== X-IronPort-AV: E=McAfee;i="6000,8403,9677"; a="136348273" X-IronPort-AV: E=Sophos;i="5.75,334,1589266800"; d="scan'208";a="136348273" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2020 20:04:57 -0700 IronPort-SDR: jJ6FzMrcbC+SkxvdMJJJq1dD8aLxAUC10P4p0Qdd7T3SFCg4/ydqfa8YyRjeJz89OBefvGHn+V aze7zW4CIbKw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,334,1589266800"; d="scan'208";a="484030332" X-Received: from mdkinney-mobl2.amr.corp.intel.com ([10.254.110.254]) by fmsmga006.fm.intel.com with ESMTP; 09 Jul 2020 20:04:57 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Hao A Wu , Liming Gao Subject: [edk2-devel] [Patch] MdeModulePkg/Variable/RuntimeDxe: Fix return status from Reclaim() Date: Thu, 9 Jul 2020 20:04:55 -0700 Message-Id: <20200710030455.6036-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com X-Gm-Message-State: Ml6JeqLJX0DDW214kZfwe4FYx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1594350299; bh=ksp8x0Ig3gAFhIweOgcg4uiwwnwCb3BB3VDVghIOGqs=; h=Cc:Date:From:Reply-To:Subject:To; b=KbE4TaYk8E2rQqfDTvoyZbGTBdDNe2Vj9zCTKHuZMvGifApfM33/YdlVsIoE63mQYBi 8I0vkBPzZmzCfCXa++8mXesmw8n26fzBxOZFaqSe1ti5PAP2pGeC99NEPflaPYv0rclrI f/wUuCqHqORsY1aXTOxDgpvwmEbqIDBlg3w= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2844 Update Reclaim() to return the error status from the reclaim operation and not the status of SynchronizeRuntimeVariableCache() that can be EFI_SUCCESS even through the status from reclaim is an error. Without this change, the return status from SetVariable() can be EFI_SUCCESS even though the variable was not actually set. This occurs if the variable store is full and a Reclaim() is invoked to free up space and even after all possible space is freed, there is still not enough room for the variable being set. This condition should return EFI_OUT_OF_RESOURCES. Cc: Hao A Wu Cc: Liming Gao Signed-off-by: Michael D Kinney Reviewed-by: Hao A Wu Reviewed-by: Jian J Wang --- .../Universal/Variable/RuntimeDxe/Variable.c | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeMod= ulePkg/Universal/Variable/RuntimeDxe/Variable.c index 1e71fc642c..41f8ff4ceb 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -531,6 +531,7 @@ Reclaim ( VOID *Point1; BOOLEAN FoundAdded; EFI_STATUS Status; + EFI_STATUS DoneStatus; UINTN CommonVariableTotalSize; UINTN CommonUserVariableTotalSize; UINTN HwErrVariableTotalSize; @@ -774,25 +775,30 @@ Reclaim ( } =20 Done: + DoneStatus =3D EFI_SUCCESS; if (IsVolatile || mVariableModuleGlobal->VariableGlobal.EmuNvMode) { - Status =3D SynchronizeRuntimeVariableCache ( - &mVariableModuleGlobal->VariableGlobal.VariableRuntimeCach= eContext.VariableRuntimeVolatileCache, - 0, - VariableStoreHeader->Size - ); - ASSERT_EFI_ERROR (Status); + DoneStatus =3D SynchronizeRuntimeVariableCache ( + &mVariableModuleGlobal->VariableGlobal.VariableRuntimeC= acheContext.VariableRuntimeVolatileCache, + 0, + VariableStoreHeader->Size + ); + ASSERT_EFI_ERROR (DoneStatus); FreePool (ValidBuffer); } else { // // For NV variable reclaim, we use mNvVariableCache as the buffer, so = copy the data back. // CopyMem (mNvVariableCache, (UINT8 *) (UINTN) VariableBase, VariableSto= reHeader->Size); - Status =3D SynchronizeRuntimeVariableCache ( - &mVariableModuleGlobal->VariableGlobal.VariableRuntimeCach= eContext.VariableRuntimeNvCache, - 0, - VariableStoreHeader->Size - ); - ASSERT_EFI_ERROR (Status); + DoneStatus =3D SynchronizeRuntimeVariableCache ( + &mVariableModuleGlobal->VariableGlobal.VariableRuntimeC= acheContext.VariableRuntimeNvCache, + 0, + VariableStoreHeader->Size + ); + ASSERT_EFI_ERROR (DoneStatus); + } + + if (!EFI_ERROR (Status) && EFI_ERROR (DoneStatus)) { + Status =3D DoneStatus; } =20 return Status; --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#62327): https://edk2.groups.io/g/devel/message/62327 Mute This Topic: https://groups.io/mt/75412007/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-