From nobody Tue Feb 10 11:13:06 2026 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+52719+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+52719+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1578020688; cv=none; d=zohomail.com; s=zohoarc; b=CVHJimlnqW4Fxv1JOnt3hU0GsgPekzWCCCLGnP0OIRjzcq1dqfG7IfL5vdKq8OLy8WborsrZ4Lkg7QtcjNv2YawpfWv4/rd7LwlVxHQZiApFEJii5qpHbVTh9z9sylPajUO3ZRhJMj6e7y8ACgGUYGRZ35xn2kPnN4xH7Ghhhp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578020688; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=rjmayBIeMYm9C28rXpqsV/k2NovJ7Dey4V0lHIHMlxs=; b=Y49RGIeq5kQlNzjUeX3UIVJRc9dn41zWv41p/Pf1qG7WuSx9ZQKzZFytYYxFk1A0jQ+svCHc5tTrJmxR+71hdJHF9Wb/KJJPGXVXDMCfF7Dm6MGJ1nZqVAIM06vElH2Ofb0rs9zwdpti59QLKUvaYmqXIfShgEfCxXjIRX3lGks= 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+52719+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 157802068882673.9099572013613; Thu, 2 Jan 2020 19:04:48 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id YjGeYY1788612xdrDx8AsmW0; Thu, 02 Jan 2020 19:04:48 -0800 X-Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.3729.1578020675360032184 for ; Thu, 02 Jan 2020 19:04:47 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jan 2020 19:04:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,389,1571727600"; d="scan'208";a="252455215" X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga002.fm.intel.com with ESMTP; 02 Jan 2020 19:04:47 -0800 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jiewen Yao , Jian J Wang , Chao Zhang Subject: [edk2-devel] [PATCH 12/13] SecurityPkg/TcgPhysicalPresenceLib: Replace the ASSERT with error code Date: Fri, 3 Jan 2020 11:04:26 +0800 Message-Id: <20200103030428.28176-13-zhichao.gao@intel.com> In-Reply-To: <20200103030428.28176-1-zhichao.gao@intel.com> References: <20200103030428.28176-1-zhichao.gao@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,zhichao.gao@intel.com X-Gm-Message-State: mKFsM67CBrbVf3WMoxcnVZqTx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578020688; bh=uaPBFZoYW/k0trXpgd2bq9Yb50LV81ySKtckP6Pub0E=; h=Cc:Date:From:Reply-To:Subject:To; b=C/xIw5tTWVW5gYJat+edwtOaKWCYg/FAbwuTdA7nsq7Wth6rCNghHuDB898vst4ZRzs eyP6Jev2tgX9IYxhdLW/yU5SESMh1Mr6pp4od/A/uf4T9mI3oJM7++Fd8Fjha0eeo1vL4 30YepmAigzsSyPsrJN1b/uvdtaVANw56dN8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2443 Replace the ASSERT with the error code return in the TpmPhysicalPresence and GetTpmCapability. Add missing error checking after call TpmPhysicalPresence in TcgPhysicalPresenceLibProcessRequest. Cc: Jiewen Yao Cc: Jian J Wang Cc: Chao Zhang Signed-off-by: Zhichao Gao --- .../DxeTcgPhysicalPresenceLib.c | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPr= esenceLib.c b/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalP= resenceLib.c index 14423991f0..7fb2ef9735 100644 --- a/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceL= ib.c +++ b/SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceL= ib.c @@ -104,9 +104,13 @@ GetTpmCapability ( sizeof (RecvBuffer), (UINT8*)&RecvBuffer ); - ASSERT_EFI_ERROR (Status); - ASSERT (TpmRsp->tag =3D=3D SwapBytes16 (TPM_TAG_RSP_COMMAND)); - ASSERT (TpmRsp->returnCode =3D=3D 0); + if (EFI_ERROR (Status)) { + return Status; + } + + if ((TpmRsp->tag !=3D SwapBytes16 (TPM_TAG_RSP_COMMAND)) || (TpmRsp->ret= urnCode !=3D 0)) { + return EFI_DEVICE_ERROR; + } =20 TpmPermanentFlags =3D (TPM_PERMANENT_FLAGS *)&RecvBuffer[sizeof (TPM_RSP= _COMMAND_HDR) + sizeof (UINT32)]; =20 @@ -159,8 +163,14 @@ TpmPhysicalPresence ( sizeof (TpmRsp), (UINT8*)&TpmRsp ); - ASSERT_EFI_ERROR (Status); - ASSERT (TpmRsp.tag =3D=3D SwapBytes16 (TPM_TAG_RSP_COMMAND)); + if (EFI_ERROR (Status)) { + return Status; + } + + if (TpmRsp.tag !=3D SwapBytes16 (TPM_TAG_RSP_COMMAND)) { + return EFI_DEVICE_ERROR; + } + if (TpmRsp.returnCode !=3D 0) { // // If it fails, some requirements may be needed for this command. @@ -1298,6 +1308,9 @@ TcgPhysicalPresenceLibProcessRequest ( // Set operator physical presence flags // TpmPhysicalPresence (TcgProtocol, TPM_PHYSICAL_PRESENCE_PRESENT); + if (EFI_ERROR (Status)) { + return; + } =20 // // Execute pending TPM request. --=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 (#52719): https://edk2.groups.io/g/devel/message/52719 Mute This Topic: https://groups.io/mt/69392342/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-