NetworkPkg: Fix suspicious dereference of pointer before NULL check

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
This commit is contained in:
Jiaxin Wu 2015-12-25 08:10:37 +00:00 committed by jiaxinwu
parent 1254d3a989
commit 5346adbb18
1 changed files with 4 additions and 1 deletions

View File

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