From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=siyuan.fu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 129E9211B63EF for ; Thu, 17 Jan 2019 17:59:49 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jan 2019 17:59:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,489,1539673200"; d="scan'208";a="311402511" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 17 Jan 2019 17:59:49 -0800 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 17 Jan 2019 17:59:49 -0800 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 17 Jan 2019 17:59:48 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.150]) by SHSMSX154.ccr.corp.intel.com ([169.254.7.46]) with mapi id 14.03.0415.000; Fri, 18 Jan 2019 09:59:47 +0800 From: "Fu, Siyuan" To: "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Ye, Ting" , "Wu, Hao A" , "Gao, Liming" Thread-Topic: [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check. Thread-Index: AQHUrgAiHhJApSAZp06iLg7aL3CjuqW0RmgA Date: Fri, 18 Jan 2019 01:59:46 +0000 Message-ID: References: <20190117010048.19020-1-Jiaxin.wu@intel.com> <20190117010048.19020-2-Jiaxin.wu@intel.com> In-Reply-To: <20190117010048.19020-2-Jiaxin.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWMwZDVkZjYtMGQwNi00M2IyLTk3MDctZDNhM2UzZDdmM2VmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiU0Y2NVd4dEZCWjRtMkFaMlU3UGFRdHpSTFNIaUZiZUdoY2x2dlRoTEltXC9UQjhPZzYyYzI1S1ZxTjk1eHR5TlEifQ== dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL pointer check. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jan 2019 01:59:50 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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, H= ao A > ; Gao, Liming ; Wu, Jiaxin > > Subject: [PATCH v1 1/3] MdeModulePkg/Dhcp4Dxe: Remove unnecessary NULL po= inter > check. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1469 >=20 > Since the value of Instance is retrieved from the list Entry, > it can't be the NULL pointer, so just remove the unnecessary > check. >=20 > 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(-) >=20 > 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. >=20 > -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 BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > http://opensource.org/licenses/bsd-license.php >=20 > @@ -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; >=20 > + Entry =3D NULL; > DhcpSb =3D (DHCP_SERVICE *) Context; > Instance =3D DhcpSb->ActiveChild; >=20 > // > // 0xffff is the maximum supported value for elapsed time according to= RFC. > @@ -1644,18 +1644,15 @@ DhcpOnTimerTick ( >=20 > 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 =3D NET_LIST_USER_STRUCT (Entry, DHCP_PROTOCOL, Link); > - > - if ((Instance !=3D NULL) && (Instance->Token !=3D NULL)) { > - Instance->Timeout--; > - if (Instance->Timeout =3D=3D 0) { > - PxeDhcpDone (Instance); > - } > + Instance->Timeout--; > + if (Instance->Timeout =3D=3D 0) { > + PxeDhcpDone (Instance); > } > } >=20 > return ; >=20 > -- > 2.17.1.windows.2