From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 9A18D21BB2524 for ; Thu, 15 Jun 2017 00:36:52 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jun 2017 00:38:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,342,1493708400"; d="scan'208";a="1160745244" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 15 Jun 2017 00:38:08 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 15 Jun 2017 00:38:08 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 15 Jun 2017 00:38:08 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.197]) with mapi id 14.03.0319.002; Thu, 15 Jun 2017 15:36:23 +0800 From: "Gao, Liming" To: Amit Kumar , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: [edk2] [PATCH] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol Thread-Index: AQHS5EK8mXAIOxf8AUid0+fqMcujV6Iliz4A Date: Thu, 15 Jun 2017 07:36:24 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D7497D2@shsmsx102.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Thu, 15 Jun 2017 07:36:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Amit: I have minor comments.=20 1) The first changed sentence should have {} for return EFI_INVALID_PARAMET= ER; to follow coding style.=20 2) In the second change, the comment "Return NULL Interface if Unsupported = Protocal" should be updated to protocol.=20 Thanks Liming >-----Original Message----- >From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of >Amit Kumar >Sent: Tuesday, June 13, 2017 8:45 PM >To: edk2-devel@lists.01.org >Cc: Tian, Feng >Subject: [edk2] [PATCH] MdeModulePkg/DxeCore: Fixed Interface returned >by CoreOpenProtocol > >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/Hand/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; > > // > // 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; > } > >- // >- // 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; > > ByDriver =3D FALSE; >@@ -1175,6 +1166,15 @@ CoreOpenProtocol ( > } > > 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 > // >-- >1.9.1 > >_______________________________________________ >edk2-devel mailing list >edk2-devel@lists.01.org >https://lists.01.org/mailman/listinfo/edk2-devel