public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zeng, Star" <star.zeng@intel.com>
To: Amit Kumar <amit.ak@samsung.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Tian, Feng" <feng.tian@intel.com>,
	"Gao, Liming" <liming.gao@intel.com>,
	 "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol
Date: Mon, 26 Jun 2017 02:46:55 +0000	[thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B8ED316@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B8ED16D@shsmsx102.ccr.corp.intel.com>

Patch has been pushed at 45cfcd8dccf84b8abbc1d6f587fedb5d2037ec79. :)

Thanks,
Star
-----Original Message-----
From: Zeng, Star 
Sent: Monday, June 26, 2017 9:20 AM
To: Amit Kumar <amit.ak@samsung.com>; edk2-devel@lists.01.org
Cc: Tian, Feng <feng.tian@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: RE: [edk2] [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol

Reviewed-by: Star Zeng <star.zeng@intel.com>

-----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 <feng.tian@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Zeng, Star <star.zeng@intel.com>
Subject: [edk2] [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol

Change since v3:
1) Fixed issue when Attributes = EFI_OPEN_PROTOCOL_TEST_PROTOCOL and Inteface = 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 <amit.ak@samsung.com>
---
 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/Hand/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 != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
-    if (Interface == NULL) {
-      return EFI_INVALID_PARAMETER;
-    } else {
-      *Interface = NULL;
-    }
+  if ((Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) && (Interface == NULL)) {
+    return EFI_INVALID_PARAMETER;
   }
 
   //
@@ -1075,15 +1071,13 @@ CoreOpenProtocol (
   Prot = CoreGetProtocolInterface (UserHandle, Protocol);
   if (Prot == NULL) {
     Status = EFI_UNSUPPORTED;
+    if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL){
+      //Return NULL Interface if Unsupported Protocol
+      *Interface = NULL;
+    }
     goto Done;
   }
 
-  //
-  // This is the protocol interface entry for this protocol
-  //
-  if (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
-    *Interface = Prot->Interface;
-  }
   Status = EFI_SUCCESS;
 
   ByDriver        = FALSE;
@@ -1177,6 +1171,14 @@ 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 (!EFI_ERROR (Status) && (Attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) {
+    *Interface = 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


  reply	other threads:[~2017-06-26  2:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170623100913epcas5p3a10353593d6348b5bf3c890e2deaadb7@epcas5p3.samsung.com>
2017-06-23 10:09 ` [PATCH V4] MdeModulePkg/DxeCore: Fixed Interface returned by CoreOpenProtocol Amit Kumar
2017-06-26  1:19   ` Zeng, Star
2017-06-26  2:46     ` Zeng, Star [this message]
2017-06-27  0:47   ` Laszlo Ersek
2017-06-27  0:52     ` Zeng, Star
2017-06-27  1:37       ` Zeng, Star
2017-06-27  9:44         ` Laszlo Ersek
2017-06-27  9:59           ` Zeng, Star
2017-06-27 11:15             ` Laszlo Ersek
2017-06-27 13:23               ` Laszlo Ersek
2017-06-27 13:31                 ` Zeng, Star
2017-06-28  9:34                   ` Zeng, Star
2017-06-28 12:39                     ` Laszlo Ersek
2017-06-28 13:00                       ` Zeng, Star

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0C09AFA07DD0434D9E2A0C6AEB0483103B8ED316@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox