From nobody Wed May 8 07:59:18 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 1497523158185832.4134594246035; Thu, 15 Jun 2017 03:39:18 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 59FA321C8EFD3; Thu, 15 Jun 2017 03:37:59 -0700 (PDT) Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) (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 DA78521C8EFA9 for ; Thu, 15 Jun 2017 03:37:57 -0700 (PDT) Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20170615103912epoutp038d7ad9ed3049e49f1b235f025ccb43f1~IRV_HdjKF2474724747epoutp03a; Thu, 15 Jun 2017 10:39:12 +0000 (GMT) Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20170615103912epcas1p20678df431edc47f2b8e597dd171cdd5e~IRV9l2KsG0911609116epcas1p2B; Thu, 15 Jun 2017 10:39:12 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id AE.A8.22623.0D362495; Thu, 15 Jun 2017 19:39:12 +0900 (KST) Received: from epsmgms2p1.samsung.com (unknown [182.195.42.79]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20170615103911epcas1p2300931e1dc457870558520c69015f0d2~IRV9VtkKy2256122561epcas1p2U; Thu, 15 Jun 2017 10:39:11 +0000 (GMT) Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 78.4C.02179.FC362495; Thu, 15 Jun 2017 19:39:11 +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 <0ORL006AX495NC90@mmp2.samsung.com>; Thu, 15 Jun 2017 19:39:11 +0900 (KST) X-Original-To: edk2-devel@lists.01.org X-AuditID: b6c32a36-f790e6d00000585f-07-594263d00913 From: Amit Kumar To: edk2-devel@lists.01.org Date: Thu, 15 Jun 2017 16:10:10 +0530 Message-id: X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJIsWRmVeSWpSXmKPExsWy7bCmge6FZKdIg7VH2CxWLjvNbLHlwCZW iz2HjjJbTNrN7sDi8bjnDJvH4j0vmTy6Z/9j8ejbsooxgCWKyyYlNSezLLVI3y6BK2PB60ds BWsFKva8XsLUwHiVp4uRk0NCwETizckVbBC2mMSFe+uBbC4OIYEdjBIHFl5mhHA+M0p8f7iS CaZj1YPDUFVrGSXmN3VBVTUxScy+9gCsik1ATWJqyyJWEFtEQFpiw9X17CA2s0CAxPvmDyxd jBwcwgKREgfvxYKEWQRUJV5/OQJWwisQLdH/Zy8rxDI5iZPHJrOCzJcQWMMm8eDMDXaQXgkB WYlNB5ghalwkGpZeZ4ewhSVeHd8CZUtJNL58CHV0tcTSL/MZIea0MErM+3gNqtle4uKev0wQ t/FJvPvawwoxn1eio00IosRD4vGMFhYI21Hi86OlbCAlQgKxEq9PKk5glF7AyLCKUSy1oDg3 PbXYsMBIrzgxt7g0L10vOT93EyM4ArXMdjAuOudziFGAg1GJh3eFqWOkEGtiWXFl7iFGCQ5m JRFeWwWnSCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8ouuvRQgJpCeWpGanphakFsFkmTg4pRoY o3WMzSx9vjwRr4x4+XEyf/eHvUfaNxovPcgyI/fRHdWqWzEK54zMst6WcE+bWlR89F91mMOK /fr73i/mWanYrhxgPPmky9z+1ccYVix5d7RNQqLPt+Dj6hh3cz5e3zieueuYr95+z614YLfh H6nYuZN36Z9babZ/ZfsujWV7/853vanhfnTGdSWW4oxEQy3mouJEANHkNUm8AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrELMWRmVeSWpSXmKPExsVy+t9jQd3zyU6RBvdmGlusXHaa2WLLgU2s FnsOHWW2mLSb3YHF43HPGTaPxXteMnl0z/7H4tG3ZRVjAEuUm01GamJKapFCal5yfkpmXrqt UmiIm66FkkJeYm6qrVKErm9IkJJCWWJOKZBnZIAGHJwD3IOV9O0S3DIWvH7EVrBWoGLP6yVM DYxXeboYOTkkBEwkVj04zAZhi0lcuLceyObiEBJYzSix6dJGVginhUli3ZttYFVsAmoSU1sW sYLYIgLSEhuurmcHsZkF/CSW7u9n7mLk4BAWiJQ4eC8WJMwioCrx+ssRsBJegWiJyY8fMEMs k5M4eWwy6wRG7gWMDKsYuVILinPTc4uNCgw3MQLDa9thLf8djD/ORh9iFOBgVOLh5bB3jBRi TSwrrsw9xCjBwawkwmur4BQpxJuSWFmVWpQfX1Sak1p8iNEUaOVEZinR5Hxg6OeVxBuaWBqZ GJiZGRoZGJspifNOCPwSISSQnliSmp2aWpBaBNPHxMEp1cDo03FZInrVF8vdE3vPiaobFair s0ztFi6/mDGxt7HXoXLe9yubb2W9ldx5ZO08hd9pLY/uzTd/yPc+5KCE6Jk8m11a9zVXHlZK 8CkoM/0Tbztlen20Zdw+Ncb9FRfFRBXU67oetloF+iRVRLNEt79Pv7zm8DaG5u8Pk1mqbrEc qxB+o2P+focSS3FGoqEWc1FxIgDKUgu6RQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170615103911epcas1p2300931e1dc457870558520c69015f0d2 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: 20170615103911epcas1p2300931e1dc457870558520c69015f0d2 X-RootMTR: 20170615103911epcas1p2300931e1dc457870558520c69015f0d2 References: Subject: [edk2] [PATCH V2] 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: akamit9@hotmail.com, 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" Change since v1: 1) Fixed typo protocal to protocol 2) Fixed coding style 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 | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Ha= nd/Handle.c index 1c25521..db23170 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1004,12 +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 // @@ -1073,15 +1069,11 @@ CoreOpenProtocol ( Prot =3D CoreGetProtocolInterface (UserHandle, Protocol); if (Prot =3D=3D NULL) { Status =3D EFI_UNSUPPORTED; + // Return NULL Interface if Unsupported Protocol + *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 +1167,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