From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 CCACB2095D20B for ; Sun, 25 Jun 2017 19:45:29 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2017 19:46:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,393,1493708400"; d="scan'208";a="278558587" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 25 Jun 2017 19:46:58 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 25 Jun 2017 19:46:58 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0319.002; Mon, 26 Jun 2017 10:46:56 +0800 From: "Zeng, Star" To: Amit Kumar , "edk2-devel@lists.01.org" CC: "Tian, Feng" , "Gao, Liming" , "Kinney, Michael D" , "Zeng, Star" Thread-Topic: [edk2] [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol Thread-Index: AQHS7AjKuoA8qetP/0mehO/ktPx/caI2XHNggAAYT9A= Date: Mon, 26 Jun 2017 02:46:55 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B8ED316@shsmsx102.ccr.corp.intel.com> References: <0C09AFA07DD0434D9E2A0C6AEB0483103B8ED16D@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B8ED16D@shsmsx102.ccr.corp.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] 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: , X-List-Received-Date: Mon, 26 Jun 2017 02:45:30 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Patch has been pushed at 45cfcd8dccf84b8abbc1d6f587fedb5d2037ec79. :) Thanks, Star -----Original Message----- From: Zeng, Star=20 Sent: Monday, June 26, 2017 9:20 AM To: Amit Kumar ; edk2-devel@lists.01.org Cc: Tian, Feng ; Gao, Liming ; K= inney, Michael D ; Zeng, Star Subject: RE: [edk2] [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface return= ed by CoreOpenProtocol Reviewed-by: Star Zeng -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Amit= Kumar Sent: Friday, June 23, 2017 6:10 PM To: edk2-devel@lists.01.org Cc: Tian, Feng ; Gao, Liming ; K= inney, Michael D ; Zeng, Star Subject: [edk2] [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface returned b= y CoreOpenProtocol Change since v3: 1) Fixed issue when Attributes =3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL and Inte= face =3D NULL case. [Reported by:star.zeng at intel.com] Change Since v2: 1) Modified to use EFI_ERROR to get status code 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 | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Hand/Handle.c b/MdeModulePkg/Core/Dxe/Ha= nd/Handle.c index 59b8914..fe58b6c 100644 --- a/MdeModulePkg/Core/Dxe/Hand/Handle.c +++ b/MdeModulePkg/Core/Dxe/Hand/Handle.c @@ -1006,12 +1006,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 // @@ -1075,15 +1071,13 @@ CoreOpenProtocol ( Prot =3D CoreGetProtocolInterface (UserHandle, Protocol); if (Prot =3D=3D NULL) { Status =3D EFI_UNSUPPORTED; + if (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTOCOL){ + //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; @@ -1177,6 +1171,14 @@ 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 (!EFI_ERROR (Status) && (Attributes !=3D EFI_OPEN_PROTOCOL_TEST_PROTO= COL)) { + *Interface =3D Prot->Interface; + } // // Done. Release the database lock are return // -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel