From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0EB7981CC9 for ; Mon, 31 Oct 2016 00:35:35 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP; 31 Oct 2016 00:35:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,426,1473145200"; d="scan'208,217";a="25944535" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 31 Oct 2016 00:35:34 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 31 Oct 2016 00:35:34 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 31 Oct 2016 00:35:33 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.139]) by shsmsx102.ccr.corp.intel.com ([169.254.2.206]) with mapi id 14.03.0248.002; Mon, 31 Oct 2016 15:35:29 +0800 From: "Ye, Ting" To: "Fu, Siyuan" , "Wu, Jiaxin" , "edk2-devel@lists.01.org" CC: "Zhang, Lubo" Thread-Topic: [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it. Thread-Index: AQHSMx28ScH8UU49akKxPYEoMZq7m6DBoqGAgAAB+ACAAIfBwA== Date: Mon, 31 Oct 2016 07:35:29 +0000 Message-ID: References: <1477880581-12760-1-git-send-email-siyuan.fu@intel.com> <1477880581-12760-2-git-send-email-siyuan.fu@intel.com> <895558F6EA4E3B41AC93A00D163B7274138A0CF1@SHSMSX103.ccr.corp.intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Oct 2016 07:35:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting > From: Fu, Siyuan Sent: Monday, October 31, 2016 3:29 PM To: Wu, Jiaxin ; edk2-devel@lists.01.org Cc: Ye, Ting ; Zhang, Lubo Subject: RE: [Patch 1/2] MdeModulePkg: Check for NULL pointer before derefe= rence it. Thanks Jiaxin, you are correct. I will delete these line when commit the p= atch. BestRegards Fu Siyuan From: Wu, Jiaxin Sent: Monday, October 31, 2016 3:22 PM To: Fu, Siyuan >; edk2-deve= l@lists.01.org Cc: Ye, Ting >; Zhang, Lubo > Subject: RE: [Patch 1/2] MdeModulePkg: Check for NULL pointer before derefe= rence it. Siyuan, I think the below piece code should be dropped in EfiPxeBcSetStationIP() fu= nction: if (NewStationIp !=3D NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr= [0]), NTOHL (NewSubnetMask->Addr[0]))) { return EFI_INVALID_PARAMETER; } Others is good to me. Reviewed-By: Wu Jiaxin > Best Regards! Jiaxin > -----Original Message----- > From: Fu, Siyuan > Sent: Monday, October 31, 2016 10:23 AM > To: edk2-devel@lists.01.org > Cc: Ye, Ting >; Zhang, Lubo <= lubo.zhang@intel.com>; Wu, > Jiaxin > > Subject: [Patch 1/2] MdeModulePkg: Check for NULL pointer before > dereference it. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Fu Siyuan = > > Cc: Ye Ting > > Cc: Zhang Lubo > > Cc: Wu Jiaxin > > --- > MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > index 4746256..43568ed 100644 > --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcImpl.c > @@ -2317,6 +2317,14 @@ EfiPxeBcSetStationIP ( > if (NewSubnetMask !=3D NULL && !IP4_IS_VALID_NETMASK (NTOHL > (NewSubnetMask->Addr[0]))) { > return EFI_INVALID_PARAMETER; > } > + > + if (NewStationIp !=3D NULL) { > + if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) || > + IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) || > + (NewSubnetMask !=3D NULL && !NetIp4IsUnicast (NTOHL (NewStationI= p- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) { > + return EFI_INVALID_PARAMETER; > + } > + } > > if (NewStationIp !=3D NULL && !NetIp4IsUnicast (NTOHL (NewStationIp- > >Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) { > return EFI_INVALID_PARAMETER; > -- > 2.7.4.windows.1