public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/2] Add check to avoid use NULL pointer
@ 2017-10-27  2:23 Jiaxin Wu
  2017-10-27  2:23 ` [Patch 1/2] NetworkPkg/HttpBootDxe: " Jiaxin Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiaxin Wu @ 2017-10-27  2:23 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wu Hao A, Ye Ting, Fu Siyuan, Wu Jiaxin

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>

Jiaxin Wu (2):
  NetworkPkg/HttpBootDxe: Add check to avoid use NULL pointer
  NetworkPkg/IScsiDxe: Add check to avoid use NULL pointer

 NetworkPkg/HttpBootDxe/HttpBootDxe.c | 50 +++++++++++++++++++-----------------
 NetworkPkg/IScsiDxe/IScsiConfig.c    |  4 +++
 2 files changed, 31 insertions(+), 23 deletions(-)

-- 
1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Patch 1/2] NetworkPkg/HttpBootDxe: Add check to avoid use NULL pointer
  2017-10-27  2:23 [Patch 0/2] Add check to avoid use NULL pointer Jiaxin Wu
@ 2017-10-27  2:23 ` Jiaxin Wu
  2017-10-27  2:23 ` [Patch 2/2] NetworkPkg/IScsiDxe: " Jiaxin Wu
  2017-10-27  3:24 ` [Patch 0/2] " Wu, Hao A
  2 siblings, 0 replies; 4+ messages in thread
From: Jiaxin Wu @ 2017-10-27  2:23 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wu Hao A, Ye Ting, Fu Siyuan, Wu Jiaxin

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/HttpBootDxe/HttpBootDxe.c | 50 +++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.c b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
index b1f9042..8a61f51 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDxe.c
+++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.c
@@ -613,23 +613,25 @@ HttpBootIp4DxeDriverBindingStart (
   }
   
   return EFI_SUCCESS;
     
 ON_ERROR:
-  if (FirstStart) {
-    gBS->UninstallProtocolInterface (
-           ControllerHandle,
-           &gEfiCallerIdGuid,
-           &Private->Id
-           );
-  }
-  
-  HttpBootDestroyIp4Children (This, Private);
-  HttpBootConfigFormUnload (Private);
+  if (Private != NULL) {
+    if (FirstStart) {
+      gBS->UninstallProtocolInterface (
+             ControllerHandle,
+             &gEfiCallerIdGuid,
+             &Private->Id
+             );
+    }
+    
+    HttpBootDestroyIp4Children (This, Private);
+    HttpBootConfigFormUnload (Private);
 
-  if (FirstStart && Private != NULL) {
-    FreePool (Private);
+    if (FirstStart) {
+      FreePool (Private);
+    }
   }
 
   return Status;
 }
 
@@ -1142,23 +1144,25 @@ HttpBootIp6DxeDriverBindingStart (
   }
 
   return EFI_SUCCESS;
    
 ON_ERROR:
-  if (FirstStart) {
-    gBS->UninstallProtocolInterface (
-           ControllerHandle,
-           &gEfiCallerIdGuid,
-           &Private->Id
-           );
-  }
+  if (Private != NULL) {
+    if (FirstStart) {
+      gBS->UninstallProtocolInterface (
+             ControllerHandle,
+             &gEfiCallerIdGuid,
+             &Private->Id
+             );
+    }
 
-  HttpBootDestroyIp6Children(This, Private);
-  HttpBootConfigFormUnload (Private);
+    HttpBootDestroyIp6Children(This, Private);
+    HttpBootConfigFormUnload (Private);
 
-  if (FirstStart && Private != NULL) {
-    FreePool (Private);
+    if (FirstStart) {
+      FreePool (Private);
+    }
   }
 
   return Status;
 }
 
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Patch 2/2] NetworkPkg/IScsiDxe: Add check to avoid use NULL pointer
  2017-10-27  2:23 [Patch 0/2] Add check to avoid use NULL pointer Jiaxin Wu
  2017-10-27  2:23 ` [Patch 1/2] NetworkPkg/HttpBootDxe: " Jiaxin Wu
@ 2017-10-27  2:23 ` Jiaxin Wu
  2017-10-27  3:24 ` [Patch 0/2] " Wu, Hao A
  2 siblings, 0 replies; 4+ messages in thread
From: Jiaxin Wu @ 2017-10-27  2:23 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wu Hao A, Ye Ting, Fu Siyuan, Wu Jiaxin

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Patch 0/2] Add check to avoid use NULL pointer
  2017-10-27  2:23 [Patch 0/2] Add check to avoid use NULL pointer Jiaxin Wu
  2017-10-27  2:23 ` [Patch 1/2] NetworkPkg/HttpBootDxe: " Jiaxin Wu
  2017-10-27  2:23 ` [Patch 2/2] NetworkPkg/IScsiDxe: " Jiaxin Wu
@ 2017-10-27  3:24 ` Wu, Hao A
  2 siblings, 0 replies; 4+ messages in thread
From: Wu, Hao A @ 2017-10-27  3:24 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan, Wu, Jiaxin

Reviewed-by: Hao Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiaxin
> Wu
> Sent: Friday, October 27, 2017 10:24 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A; Ye, Ting; Fu, Siyuan; Wu, Jiaxin
> Subject: [edk2] [Patch 0/2] Add check to avoid use NULL pointer
> 
> 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>
> 
> Jiaxin Wu (2):
>   NetworkPkg/HttpBootDxe: Add check to avoid use NULL pointer
>   NetworkPkg/IScsiDxe: Add check to avoid use NULL pointer
> 
>  NetworkPkg/HttpBootDxe/HttpBootDxe.c | 50 +++++++++++++++++++------------
> -----
>  NetworkPkg/IScsiDxe/IScsiConfig.c    |  4 +++
>  2 files changed, 31 insertions(+), 23 deletions(-)
> 
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-27  3:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-27  2:23 [Patch 0/2] Add check to avoid use NULL pointer Jiaxin Wu
2017-10-27  2:23 ` [Patch 1/2] NetworkPkg/HttpBootDxe: " Jiaxin Wu
2017-10-27  2:23 ` [Patch 2/2] NetworkPkg/IScsiDxe: " Jiaxin Wu
2017-10-27  3:24 ` [Patch 0/2] " Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox