Re: [edk2] [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check.

2019-01-17 Thread Wu, Jiaxin
Thanks Siyuan, I will double check that.



> -Original Message-
> From: Fu, Siyuan
> Sent: Friday, January 18, 2019 10:00 AM
> To: Wu, Jiaxin ; edk2-devel@lists.01.org
> Cc: Ye, Ting ; Wu, Hao A ; Gao,
> Liming 
> Subject: RE: [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove
> unnecessary NULL pointer check.
> 
> Hi, Jiaxin
> 
> > -Original Message-
> > From: Wu, Jiaxin
> > Sent: Thursday, January 17, 2019 9:01 AM
> > To: edk2-devel@lists.01.org
> > Cc: Ye, Ting ; Fu, Siyuan ; Wu,
> Hao A
> > ; Gao, Liming ; Wu, Jiaxin
> > 
> > Subject: [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary
> NULL pointer
> > check.
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469
> >
> > Since the value of Instance is retrieved from the list Entry,
> > it can't be the NULL pointer, so just remove the unnecessary
> > check.
> >
> > Cc: Ye Ting 
> > Cc: Fu Siyuan 
> > Cc: Wu Hao A 
> > Cc: Gao Liming 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Wu Jiaxin 
> > ---
> >  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 15 ++
> -
> >  1 file changed, 6 insertions(+), 9 deletions(-)
> >
> > diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
> > b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
> > index 98a22a77b4..04d47e0759 100644
> > --- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
> > +++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
> > @@ -1,9 +1,9 @@
> >  /** @file
> >EFI DHCP protocol implementation.
> >
> > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> > +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> >  This program and the accompanying materials
> >  are licensed and made available under the terms and conditions of the BSD
> > License
> >  which accompanies this distribution.  The full text of the license may be
> > found at
> >  http://opensource.org/licenses/bsd-license.php
> >
> > @@ -1493,15 +1493,15 @@ DhcpOnTimerTick (
> >IN EFI_EVENT  Event,
> >IN VOID   *Context
> >)
> >  {
> >LIST_ENTRY*Entry;
> > -  LIST_ENTRY*Next;
> >DHCP_SERVICE  *DhcpSb;
> >DHCP_PROTOCOL *Instance;
> >EFI_STATUSStatus;
> >
> > +  Entry= NULL;
> >DhcpSb   = (DHCP_SERVICE *) Context;
> >Instance = DhcpSb->ActiveChild;
> >
> >//
> >// 0x is the maximum supported value for elapsed time according to
> RFC.
> > @@ -1644,18 +1644,15 @@ DhcpOnTimerTick (
> >
> >  ON_EXIT:
> >//
> >// Iterate through all the DhcpSb Children.
> >//
> > -  NET_LIST_FOR_EACH_SAFE (Entry, Next, >Children) {
> > +  NET_LIST_FOR_EACH (Entry, >Children) {
> 
> The DHCP Instance might be destroyed in PxeDhcpDone (it singals upper
> layer that the DHCP is completed), and the NET_LIST_FOR_EACH is not
> delete-safe, you should not replace it with NET_LIST_FOR_EACH.
> 
> >  Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);
> > -
> > -if ((Instance != NULL) && (Instance->Token != NULL)) {
> > -  Instance->Timeout--;
> > -  if (Instance->Timeout == 0) {
> > -PxeDhcpDone (Instance);
> > -  }
> > +Instance->Timeout--;
> > +if (Instance->Timeout == 0) {
> > +  PxeDhcpDone (Instance);
> >  }
> >}
> >
> >return ;
> >
> > --
> > 2.17.1.windows.2

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


[edk2] [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check.

2019-01-16 Thread Jiaxin Wu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1469

Since the value of Instance is retrieved from the list Entry,
it can't be the NULL pointer, so just remove the unnecessary
check.

Cc: Ye Ting 
Cc: Fu Siyuan 
Cc: Wu Hao A 
Cc: Gao Liming 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c 
b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
index 98a22a77b4..04d47e0759 100644
--- a/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
+++ b/MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Io.c
@@ -1,9 +1,9 @@
 /** @file
   EFI DHCP protocol implementation.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
 http://opensource.org/licenses/bsd-license.php
 
@@ -1493,15 +1493,15 @@ DhcpOnTimerTick (
   IN EFI_EVENT  Event,
   IN VOID   *Context
   )
 {
   LIST_ENTRY*Entry;
-  LIST_ENTRY*Next;
   DHCP_SERVICE  *DhcpSb;
   DHCP_PROTOCOL *Instance;
   EFI_STATUSStatus;
 
+  Entry= NULL;
   DhcpSb   = (DHCP_SERVICE *) Context;
   Instance = DhcpSb->ActiveChild;
 
   //
   // 0x is the maximum supported value for elapsed time according to RFC.
@@ -1644,18 +1644,15 @@ DhcpOnTimerTick (
 
 ON_EXIT:
   //
   // Iterate through all the DhcpSb Children.
   //
-  NET_LIST_FOR_EACH_SAFE (Entry, Next, >Children) {
+  NET_LIST_FOR_EACH (Entry, >Children) {
 Instance = NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link);
-
-if ((Instance != NULL) && (Instance->Token != NULL)) {
-  Instance->Timeout--;
-  if (Instance->Timeout == 0) {
-PxeDhcpDone (Instance);
-  }
+Instance->Timeout--;
+if (Instance->Timeout == 0) {
+  PxeDhcpDone (Instance);
 }
   }
 
   return ;
 
-- 
2.17.1.windows.2

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