public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
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>, "Zhang, Lubo" <lubo.zhang@intel.com>
Subject: Re: [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it.
Date: Mon, 31 Oct 2016 07:29:10 +0000	[thread overview]
Message-ID: <B1FF2E9001CE9041BD10B825821D5BC58A8350D3@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <895558F6EA4E3B41AC93A00D163B7274138A0CF1@SHSMSX103.ccr.corp.intel.com>

Thanks Jiaxin, you are correct.  I will delete these line when commit the patch.

BestRegards
Fu Siyuan

From: Wu, Jiaxin
Sent: Monday, October 31, 2016 3:22 PM
To: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Zhang, Lubo <lubo.zhang@intel.com>
Subject: RE: [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it.

Siyuan,

I think the below piece code should be dropped in EfiPxeBcSetStationIP() function:

  if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp->Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) {
    return EFI_INVALID_PARAMETER;
  }

Others is good to me.

Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>>


Best Regards!
Jiaxin

> -----Original Message-----
> From: Fu, Siyuan
> Sent: Monday, October 31, 2016 10:23 AM
> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Ye, Ting <ting.ye@intel.com<mailto:ting.ye@intel.com>>; Zhang, Lubo <lubo.zhang@intel.com<mailto:lubo.zhang@intel.com>>; Wu,
> Jiaxin <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>>
> Subject: [Patch 1/2] MdeModulePkg: Check for NULL pointer before
> dereference it.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com<mailto:siyuan.fu@intel.com>>
> Cc: Ye Ting <ting.ye@intel.com<mailto:ting.ye@intel.com>>
> Cc: Zhang Lubo <lubo.zhang@intel.com<mailto:lubo.zhang@intel.com>>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com<mailto:jiaxin.wu@intel.com>>
> ---
>  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 != NULL && !IP4_IS_VALID_NETMASK (NTOHL
> (NewSubnetMask->Addr[0]))) {
>      return EFI_INVALID_PARAMETER;
>    }
> +
> +  if (NewStationIp != NULL) {
> +    if (IP4_IS_UNSPECIFIED(NTOHL (NewStationIp->Addr[0])) ||
> +        IP4_IS_LOCAL_BROADCAST(NTOHL (NewStationIp->Addr[0])) ||
> +        (NewSubnetMask != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp-
> >Addr[0]), NTOHL (NewSubnetMask->Addr[0])))) {
> +      return EFI_INVALID_PARAMETER;
> +    }
> +  }
>
>    if (NewStationIp != NULL && !NetIp4IsUnicast (NTOHL (NewStationIp-
> >Addr[0]), NTOHL (NewSubnetMask->Addr[0]))) {
>      return EFI_INVALID_PARAMETER;
> --
> 2.7.4.windows.1


  reply	other threads:[~2016-10-31  7:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31  2:22 [Patch 0/2] Check for NULL pointer before dereference Fu Siyuan
2016-10-31  2:23 ` [Patch 1/2] MdeModulePkg: Check for NULL pointer before dereference it Fu Siyuan
2016-10-31  7:22   ` Wu, Jiaxin
2016-10-31  7:29     ` Fu, Siyuan [this message]
2016-10-31  7:35       ` Ye, Ting
2016-10-31  2:23 ` [Patch 2/2] NetworkPkg: " Fu Siyuan
2016-10-31  7:22   ` Wu, Jiaxin
2016-10-31  7:35     ` Ye, Ting

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=B1FF2E9001CE9041BD10B825821D5BC58A8350D3@shsmsx102.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