This patch is used to fix suspicious dereference of pointer before
NULL check in IScsiDxe driver.

Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <[email protected]>
---
 NetworkPkg/IScsiDxe/IScsiDriver.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiDriver.c 
b/NetworkPkg/IScsiDxe/IScsiDriver.c
index a7031df..51ce169 100644
--- a/NetworkPkg/IScsiDxe/IScsiDriver.c
+++ b/NetworkPkg/IScsiDxe/IScsiDriver.c
@@ -103,11 +103,12 @@ IScsiCheckAip (
   UINT8                            NetworkBootPolicy;
 
   //
   // Check any AIP instances exist in system.
   //
-  AipHandleCount = 0;
+  AipHandleCount  = 0;
+  AipHandleBuffer = NULL;
   Status = gBS->LocateHandleBuffer (
                   ByProtocol,
                   &gEfiAdapterInformationProtocolGuid,
                   NULL,
                   &AipHandleCount,
@@ -115,10 +116,12 @@ IScsiCheckAip (
                   );
   if (EFI_ERROR (Status) || AipHandleCount == 0) {
     return EFI_NOT_FOUND;
   }
 
+  ASSERT (AipHandleBuffer != NULL);
+
   InfoBlock = NULL;
 
   for (AipIndex = 0; AipIndex < AipHandleCount; AipIndex++) {
     Status = gBS->HandleProtocol (
                     AipHandleBuffer[AipIndex],
-- 
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to