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.20; helo=mga02.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 7F678208AE346 for ; Thu, 14 Feb 2019 21:09:23 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2019 21:09:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,371,1544515200"; d="scan'208";a="319223374" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga006.fm.intel.com with ESMTP; 14 Feb 2019 21:09:22 -0800 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Feb 2019 21:09:22 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Feb 2019 21:09:22 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.207]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.162]) with mapi id 14.03.0415.000; Fri, 15 Feb 2019 13:09:20 +0800 From: "Zeng, Star" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Wang, Jian J" , "Zeng, Star" Thread-Topic: [PATCH v4 10/13] MdeModulePkg/SmmLockBox(PEI): Remove an ASSERT in RestoreLockBox() Thread-Index: AQHUwd+GCi5B+ZriLkiVLnk9Q/jsr6XgVXEA Date: Fri, 15 Feb 2019 05:09:20 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483104026B78B@shsmsx102.ccr.corp.intel.com> References: <20190211075738.16676-1-hao.a.wu@intel.com> <20190211075738.16676-12-hao.a.wu@intel.com> In-Reply-To: <20190211075738.16676-12-hao.a.wu@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v4 10/13] 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: Fri, 15 Feb 2019 05:09:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: Wu, Hao A=20 Sent: Monday, February 11, 2019 3:58 PM To: edk2-devel@lists.01.org Cc: Wu, Hao A ; Wang, Jian J ; Z= eng, Star Subject: [PATCH v4 10/13] MdeModulePkg/SmmLockBox(PEI): Remove an ASSERT in= RestoreLockBox() 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 =3D SmmCommunicationPpi->Communicate ( SmmCommunicationPpi, &CommBuffer[0], &CommSize ); if (Status =3D=3D EFI_NOT_STARTED) { // // Pei SMM communication not ready yet, so we access SMRAM directly // DEBUG ((DEBUG_INFO, "SmmLockBoxPeiLib Communicate - (%r)\n", Status)); Status =3D InternalRestoreLockBoxFromSmram (Guid, Buffer, Length); LockBoxParameterRestore->Header.ReturnStatus =3D (UINT64)Status; if (Length !=3D NULL) { LockBoxParameterRestore->Length =3D (UINT64)*Length; } } ASSERT_EFI_ERROR (Status); It is possible for previous codes to return an error status that is possibl= e for happen. One example is that, when the 'if' statement 'if (Status =3D= =3D 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 ho= ld 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 c= odes are needed here. Cc: Jian J Wang Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu Reviewed-by: Ray Ni Reviewed-by: Laszlo Ersek --- MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c | 1 - 1 file changed, 1 deletion(-) diff --git a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c b/MdeMod= ulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c index 9f73480070..8c3e65bc96 100644 --- a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c +++ b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxPeiLib.c @@ -623,7 +623,6 @@ RestoreLockBox ( LockBoxParameterRestore->Length =3D (UINT64)*Length; } } - ASSERT_EFI_ERROR (Status); =20 if (Length !=3D NULL) { *Length =3D (UINTN)LockBoxParameterRestore->Length; -- 2.12.0.windows.1