]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg UfsPassThru: ASSERT if params are NULL in SignalCallerEvent
authorHao Wu <hao.a.wu@intel.com>
Tue, 15 Dec 2015 05:43:08 +0000 (05:43 +0000)
committerhwu1225 <hwu1225@Edk2>
Tue, 15 Dec 2015 05:43:08 +0000 (05:43 +0000)
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.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19266 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c

index 4fbe199390f404ff1cd80e134750a9923073a2c1..81653af5a8ad2af41d9ff012a58c5120364f8773 100644 (file)
@@ -2191,6 +2191,8 @@ SignalCallerEvent (
   EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;\r
   EFI_EVENT                          CallerEvent;\r
 \r
+  ASSERT ((Private != NULL) && (TransReq != NULL));\r
+\r
   UfsHc        = Private->UfsHostController;\r
   CallerEvent  = TransReq->CallerEvent;\r
 \r
@@ -2214,9 +2216,8 @@ SignalCallerEvent (
              TransReq->CmdDescHost\r
              );\r
   }\r
-  if (TransReq != NULL) {\r
-    FreePool (TransReq);\r
-  }\r
+\r
+  FreePool (TransReq);\r
 \r
   gBS->SignalEvent (CallerEvent);\r
   return;\r