[edk2] [Patch 2/2] NetworkPkg/IScsiDxe: Add check to avoid use NULL pointer

Jiaxin Wu posted 2 patches 7 years, 1 month ago
[edk2] [Patch 2/2] NetworkPkg/IScsiDxe: Add check to avoid use NULL pointer
Posted by Jiaxin Wu 7 years, 1 month ago
Cc: Wu Hao A <hao.a.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 NetworkPkg/IScsiDxe/IScsiConfig.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 3382982..62df367 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -3594,10 +3594,14 @@ IScsiFormCallback (
 
     case KEY_IP_MODE:
       switch (Value->u8) {
       case IP_MODE_IP6:
         NicInfo = IScsiGetNicInfoByIndex (Private->Current->NicIndex); 
+        if(NicInfo == NULL) {
+          break;
+        }
+
         if(!NicInfo->Ipv6Available) {			
   	      //
           // Current NIC doesn't Support IPv6, hence use IPv4.    
           //    
           IfrNvData->IpMode = IP_MODE_IP4;
-- 
1.9.5.msysgit.1

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