From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 95832211C280D for ; Wed, 30 Jan 2019 21:48:00 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2019 21:48:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,543,1539673200"; d="scan'208";a="112528882" Received: from ray-dev.ccr.corp.intel.com (HELO [10.239.9.127]) ([10.239.9.127]) by orsmga006.jf.intel.com with ESMTP; 30 Jan 2019 21:47:59 -0800 To: Hao Wu , edk2-devel@lists.01.org Cc: Jian J Wang , Ray Ni , Star Zeng References: <20190131024854.4880-1-hao.a.wu@intel.com> <20190131024854.4880-11-hao.a.wu@intel.com> From: "Ni, Ruiyu" Message-ID: <3c7c8767-23c8-e8a1-ef35-a03e37968ddb@Intel.com> Date: Thu, 31 Jan 2019 13:50:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190131024854.4880-11-hao.a.wu@intel.com> Subject: Re: [PATCH v2 10/12] MdeModulePkg/SmmLockBox(PEI): Remove an ASSERT in RestoreLockBox() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 05:48:00 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 1/31/2019 10:48 AM, Hao Wu wrote: > This commit is out of the scope for BZ-1409. It is a refinement for the > PEI library instance within SmmLockBoxLib. > > For the below ASSERT statement within function RestoreLockBox(): > Status = SmmCommunicationPpi->Communicate ( > SmmCommunicationPpi, > &CommBuffer[0], > &CommSize > ); > if (Status == EFI_NOT_STARTED) { > // > // Pei SMM communication not ready yet, so we access SMRAM directly > // > DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib Communicate - (%r)\n", Status)); > Status = InternalRestoreLockBoxFromSmram (Guid, Buffer, Length); > LockBoxParameterRestore->Header.ReturnStatus = (UINT64)Status; > if (Length != NULL) { > LockBoxParameterRestore->Length = (UINT64)*Length; > } > } > ASSERT_EFI_ERROR (Status); > > It is possible for previous codes to return an error status that is > possible for happen. One example is that, when the 'if' statement > 'if (Status == EFI_NOT_STARTED) {' is entered, function > InternalRestoreLockBoxFromSmram() is possible to return 'BUFFER_TOO_SMALL' > if the caller of RestoreLockBox() provides a buffer that is too small to > hold the content of LockBox. > > Thus, this commit will remove the ASSERT here. > > Please note that the current implementation of RestoreLockBox() is > handling the above-mentioned error case properly, so no additional error > handling codes are needed here. > > Cc: Jian J Wang > Cc: Ray Ni > Cc: Star Zeng > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Hao Wu > --- > MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c > index 9f73480070..9d7b4c3706 100644 > --- a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c > +++ b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c > @@ -623,7 +623,7 @@ RestoreLockBox ( > LockBoxParameterRestore->Length = (UINT64)*Length; > } > } > - ASSERT_EFI_ERROR (Status); > + //ASSERT_EFI_ERROR (Status); > > if (Length != NULL) { > *Length = (UINTN)LockBoxParameterRestore->Length; > Reviewed-by: Ray Ni -- Thanks, Ray