From: "Fu, Siyuan" <siyuan.fu@intel.com>
To: "Wu, Jiaxin" <jiaxin.wu@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ye, Ting" <ting.ye@intel.com>, "Wu, Hao A" <hao.a.wu@intel.com>,
"Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check.
Date: Fri, 18 Jan 2019 01:59:46 +0000 [thread overview]
Message-ID: <B1FF2E9001CE9041BD10B825821D5BC58B6CFB11@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20190117010048.19020-2-Jiaxin.wu@intel.com>
Hi, Jiaxin
> -----Original Message-----
> From: Wu, Jiaxin
> Sent: Thursday, January 17, 2019 9:01 AM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Gao, Liming <liming.gao@intel.com>; Wu, Jiaxin
> <jiaxin.wu@intel.com>
> 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 <ting.ye@intel.com>
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Wu Hao A <hao.a.wu@intel.com>
> Cc: Gao Liming <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
> ---
> 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.<BR>
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
> 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_STATUS Status;
>
> + Entry = NULL;
> DhcpSb = (DHCP_SERVICE *) Context;
> Instance = DhcpSb->ActiveChild;
>
> //
> // 0xffff 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, &DhcpSb->Children) {
> + NET_LIST_FOR_EACH (Entry, &DhcpSb->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
next prev parent reply other threads:[~2019-01-18 1:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-17 1:00 [PATCH v1 0/3] Remove unnecessary NULL pointer check Jiaxin Wu
2019-01-17 1:00 ` [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: " Jiaxin Wu
2019-01-18 1:59 ` Fu, Siyuan [this message]
2019-01-18 2:17 ` Wu, Jiaxin
2019-01-17 1:00 ` [PATCH v1 2/3] NetworkPkg/IScsiDxe: " Jiaxin Wu
2019-01-17 1:00 ` [PATCH v1 3/3] NetworkPkg/DnsDxe: " Jiaxin Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B1FF2E9001CE9041BD10B825821D5BC58B6CFB11@SHSMSX103.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox