In function SignalCallerEvent(), 'Private' and 'TransReq' are dereferenced
before NULL checking.

Since the function assumes that both 'Private' and 'TransReq' passed in
are not NULL pointer, this commit will add an ASSERT to make sure the
above assumption is satisfied.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a...@intel.com>
---
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c 
b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 4fbe199..81653af 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -2191,6 +2191,8 @@ SignalCallerEvent (
   EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;
   EFI_EVENT                          CallerEvent;
 
+  ASSERT ((Private != NULL) && (TransReq != NULL));
+
   UfsHc        = Private->UfsHostController;
   CallerEvent  = TransReq->CallerEvent;
 
@@ -2214,9 +2216,8 @@ SignalCallerEvent (
              TransReq->CmdDescHost
              );
   }
-  if (TransReq != NULL) {
-    FreePool (TransReq);
-  }
+
+  FreePool (TransReq);
 
   gBS->SignalEvent (CallerEvent);
   return;
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to