NetworkPkg: Fix suspicious dereference of pointer before NULL check
authorJiaxin Wu <jiaxin.wu@intel.com>
Fri, 25 Dec 2015 08:10:37 +0000 (08:10 +0000)
committerjiaxinwu <jiaxinwu@Edk2>
Fri, 25 Dec 2015 08:10:37 +0000 (08:10 +0000)
This patch is used to fix suspicious dereference of pointer before
NULL check in IScsiDxe driver.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19552 6f19259b-4bc3-4df7-8a09-765794883524

NetworkPkg/IScsiDxe/IScsiDriver.c

index a7031dfc4ed8d47c77c6b0672b269840ad257dca..51ce16911bcb4365a5faf032022f817871d1eab3 100644 (file)
@@ -105,7 +105,8 @@ IScsiCheckAip (
   //\r
   // Check any AIP instances exist in system.\r
   //\r
-  AipHandleCount = 0;\r
+  AipHandleCount  = 0;\r
+  AipHandleBuffer = NULL;\r
   Status = gBS->LocateHandleBuffer (\r
                   ByProtocol,\r
                   &gEfiAdapterInformationProtocolGuid,\r
@@ -117,6 +118,8 @@ IScsiCheckAip (
     return EFI_NOT_FOUND;\r
   }\r
 \r
+  ASSERT (AipHandleBuffer != NULL);\r
+\r
   InfoBlock = NULL;\r
 \r
   for (AipIndex = 0; AipIndex < AipHandleCount; AipIndex++) {\r