From nobody Sun May 5 17:26:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1497357822711268.2851922732083; Tue, 13 Jun 2017 05:43:42 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9B4A221A08D63; Tue, 13 Jun 2017 05:42:23 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (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 3BB5A21A08D63 for ; Tue, 13 Jun 2017 05:42:22 -0700 (PDT) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20170613124334epoutp04206dd31dbb8ffc431c334129db0fbb4f~Hrv-Q2R3t2354923549epoutp04z; Tue, 13 Jun 2017 12:43:34 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20170613124333epcas1p370bb9cce79e2d283d9bdaed9fe66e954~Hrv_Moau80248702487epcas1p3m; Tue, 13 Jun 2017 12:43:33 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 08.2D.03717.5FDDF395; Tue, 13 Jun 2017 21:43:33 +0900 (KST) Received: from epsmgms2p1.samsung.com (unknown [182.195.42.79]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20170613124333epcas1p2d82549b72e339e5d553b7e4ee09bfe3a~Hrv9jmxY60078200782epcas1p2_; Tue, 13 Jun 2017 12:43:33 +0000 (GMT) Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 68.7D.02179.4FDDF395; Tue, 13 Jun 2017 21:43:33 +0900 (KST) Received: from amit.kp-ubuntu.sisodomain.com ([107.108.221.253]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ORH003SSKOESMA0@mmp2.samsung.com>; Tue, 13 Jun 2017 21:43:32 +0900 (KST) X-Original-To: edk2-devel@lists.01.org X-AuditID: b6c32a39-f790c6d000000e85-92-593fddf52997 From: Amit Kumar To: edk2-devel@lists.01.org Date: Tue, 13 Jun 2017 18:14:34 +0530 Message-id: X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRmVeSWpSXmKPExsWy7bCmge7Xu/aRBttuallsObCJ1WLPoaPM FpN2szsweyze85LJo3v2PxaPvi2rGAOYo7hsUlJzMstSi/TtErgybp2/w1bQKFAxfddl1gbG LTxdjJwcEgImEvsbN7NA2GISF+6tZ+ti5OIQEtjBKLHyXBs7hPOZUWLZ9cnMMB0rz66ESqxl lJj19CCU08Qkcf/CbLAqNgE1iakti1hBbBEBaYkNV9cDFXFwMAtYSqyeXwcSFhYIlfg8rQWs nEVAVWJm80EmEJtXIFri1vFOqGVyEiePTWYFmS8hsIBNYtGa/8wgcyQEZCU2HYCqcZFYd38H lC0s8er4FnYIW0qi8eVDJgi7WmLpl/mMEHNaGCXmfbwG1WAvcXHPX7AiZgE+iXdfe1gh5vNK dLQJQZgeEq034iCqHSWaVi4AGy8kECuxbNVWtgmM0gsYGVYxiqUWFOempxYbFpjqFSfmFpfm pesl5+duYgRHm5blDsZj53wOMQpwMCrx8K6YZBcpxJpYVlyZe4hRgoNZSYRX4LZ9pBBvSmJl VWpRfnxRaU5q8SFGaQ4WJXFe0fXXIoQE0hNLUrNTUwtSi2CyTBycUg2MJ/7tzrsa6vCQ5czR 3HvZEh4bPbotORZIh771LJVfwTS3n2FZ8TLtxVnWEVvLP3vd5jvPs2it1tOUvwt1y947nd0r kiM8dcds86mT9t3b3KHT5ehgy8C4bbWSxq9Zf4yuModlRBXdTqtsKLWLFq7WzEr3+ZZ34Y94 a1/sRd8P8Q+zk6TsXtsosRRnJBpqMRcVJwIAy4PByrICAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOLMWRmVeSWpSXmKPExsVy+t9jQd2vd+0jDb65WWw5sInVYs+ho8wW k3azOzB7LN7zksmje/Y/Fo++LasYA5ij3GwyUhNTUosUUvOS81My89JtlUJD3HQtlBTyEnNT bZUidH1DgpQUyhJzSoE8IwM04OAc4B6spG+X4JZx6/wdtoJGgYrpuy6zNjBu4eli5OSQEDCR WHl2JTuELSZx4d56ti5GLg4hgdWMEl8PL2SEcFqYJJqnH2YEqWITUJOY2rKIFcQWEZCW2HB1 PVA3BwezgKXE6vl1IGFhgVCJz9NamEFsFgFViZnNB5lAbF6BaImfU3tYIZbJSZw8Npl1AiP3 AkaGVYxcqQXFuem5xUYFhpsYgYG07bCW/w7GH2ejDzEKcDAq8fCumGQXKcSaWFZcmXuIUYKD WUmEV+C2faQQb0piZVVqUX58UWlOavEhRlOglROZpUST84FBnlcSb2hiaWRiYGZmaGRgbKYk zjsh8EuEkEB6YklqdmpqQWoRTB8TB6dUAyNz+j7TBbGLzyoELNksMn2GeONzA//J2ptj/91V v/I5oEu9WEn8fph4XE7/tJ3zt76SiMo7fGoHq0fj16AzP35umOMaPdOr5aeKRuh059jLbzwk 7Hkuaxn3GPO/3sCxdPGUpy8F787KUJ79/YppLdd3NslNmc+PmWxaZpi32sApTUHwIM813WIl luKMREMt5qLiRAA3ihtnOgIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170613124333epcas1p2d82549b72e339e5d553b7e4ee09bfe3a X-Msg-Generator: CA X-Sender-IP: 182.195.42.79 X-Local-Sender: =?UTF-8?B?QW1pdCBLdW1hchtTU0lSLUhvc3QgU29sdXRpb25zG+yCvA==?= =?UTF-8?B?7ISx7KCE7J6QG0xlYWQgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QW1pdCBLdW1hchtTU0lSLUhvc3QgU29sdXRpb25zG1NhbXN1?= =?UTF-8?B?bmcgRWxlY3Ryb25pY3MbTGVhZCBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG1NXQUhRG0MxMElEMDdJRDAxMTAxMw==?= CMS-TYPE: 101P X-CMS-RootMailID: 20170613124333epcas1p2d82549b72e339e5d553b7e4ee09bfe3a X-RootMTR: 20170613124333epcas1p2d82549b72e339e5d553b7e4ee09bfe3a References: Subject: [edk2] [PATCH] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: feng.tian@intel.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Modified source code to update Interface as per spec. 1) In case of Protocol is un-supported, interface should be returned NULL. 2) In case of any error, interface should not be modified. 3) In case of Test Protocol, interface is optional. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Amit Kumar --- MdeModulePkg/Core/Dxe/Hand/Handle.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Ha= nd/Handle.c index 1c25521..0afa86b 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1004,13 +1004,8 @@ CoreOpenProtocol ( // // Check for invalid Interface // - if (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { - if (Interface =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } else { - *Interface =3D NULL; - } - } + if ((Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface =3D= =3D NULL)) + return EFI_INVALID_PARAMETER; =20 // // Check for invalid UserHandle @@ -1073,15 +1068,11 @@ CoreOpenProtocol ( Prot =3D CoreGetProtocolInterface (UserHandle, Protocol); if (Prot =3D=3D NULL) { Status =3D EFI_UNSUPPORTED; + // Return NULL Interface if Unsupported Protocal + *Interface =3D NULL; goto Done; } =20 - // - // This is the protocol interface entry for this protocol - // - if (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) { - *Interface =3D Prot->Interface; - } Status =3D EFI_SUCCESS; =20 ByDriver =3D FALSE; @@ -1175,6 +1166,15 @@ CoreOpenProtocol ( } =20 Done: + + // + // This is the protocol interface entry for this protocol. + // In case of any Error, Interface should not be updated as per spec. + // + if ((Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL) + && (Status =3D=3D EFI_SUCCESS)) { + *Interface =3D Prot->Interface; + } // // Done. Release the database lock are return // --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel