public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Maciej Rabeda <maciej.rabeda@linux.intel.com>, devel@edk2.groups.io
Cc: Jiaxin Wu <jiaxin.wu@intel.com>, Siyuan Fu <siyuan.fu@intel.com>
Subject: Re: [PATCH] NetworkPkg/Ip6Dxe: Fix ASSERT logic in Ip6ProcessRouterAdvertise()
Date: Wed, 1 Apr 2020 14:02:28 +0200	[thread overview]
Message-ID: <5ab7e131-0d14-a2ef-ec00-caf055f7a862@redhat.com> (raw)
In-Reply-To: <20200401095321.1966-1-maciej.rabeda@linux.intel.com>

Hi Maciej,

On 04/01/20 11:53, Maciej Rabeda wrote:
> This patch fixes reversed logic of recently added ASSERTs which should
> ensure that Ip6IsNDOptionValid() implementation properly reacts to invalid
> packets.
> 
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Cc: Siyuan Fu <siyuan.fu@intel.com>
> Signed-off-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
> Tested-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  NetworkPkg/Ip6Dxe/Ip6Nd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Thanks for the patch. Two meta-suggestions:

(1) we should do one of the following:

(1a) Create a new BZ for this issue, cross-link it -- via the See Also
field -- with TianoCore#2174, and reference the new BZ in this commit
message. If we file this new BZ, it should get the Regression keyword.

(1b) Or else we should reopen TianoCore#2174, and reference *that* BZ in
this commit message.

(2) Independently of (1), the commit message should carry the following tag:

Fixes: 9c20342eed70ec99ec50cd73cb81804299f05403

Regarding this patch, the above updates only affect the commit message,
so I'm not asking for a v2 -- you can implement the commit message
changes right before pushing.

Thanks!
Laszlo



> diff --git a/NetworkPkg/Ip6Dxe/Ip6Nd.c b/NetworkPkg/Ip6Dxe/Ip6Nd.c
> index fd7f60b2f92c..0780a98cb325 100644
> --- a/NetworkPkg/Ip6Dxe/Ip6Nd.c
> +++ b/NetworkPkg/Ip6Dxe/Ip6Nd.c
> @@ -2111,7 +2111,7 @@ Ip6ProcessRouterAdvertise (
>        // Option size validity ensured by Ip6IsNDOptionValid().
>        //
>        ASSERT (LinkLayerOption.Length != 0);
> -      ASSERT (Offset + (UINT32) LinkLayerOption.Length * 8 >= (UINT32) Head->PayloadLength);
> +      ASSERT (Offset + (UINT32) LinkLayerOption.Length * 8 <= (UINT32) Head->PayloadLength);
>  
>        ZeroMem (&LinkLayerAddress, sizeof (EFI_MAC_ADDRESS));
>        CopyMem (&LinkLayerAddress, LinkLayerOption.EtherAddr, 6);
> @@ -2164,7 +2164,7 @@ Ip6ProcessRouterAdvertise (
>        // Option size validity ensured by Ip6IsNDOptionValid().
>        //
>        ASSERT (PrefixOption.Length == 4);
> -      ASSERT (Offset + (UINT32) PrefixOption.Length * 8 >= (UINT32) Head->PayloadLength);
> +      ASSERT (Offset + (UINT32) PrefixOption.Length * 8 <= (UINT32) Head->PayloadLength);
>  
>        PrefixOption.ValidLifetime     = NTOHL (PrefixOption.ValidLifetime);
>        PrefixOption.PreferredLifetime = NTOHL (PrefixOption.PreferredLifetime);
> @@ -2334,7 +2334,7 @@ Ip6ProcessRouterAdvertise (
>        // Option size validity ensured by Ip6IsNDOptionValid().
>        //
>        ASSERT (MTUOption.Length == 1);
> -      ASSERT (Offset + (UINT32) MTUOption.Length * 8 >= (UINT32) Head->PayloadLength);
> +      ASSERT (Offset + (UINT32) MTUOption.Length * 8 <= (UINT32) Head->PayloadLength);
>  
>        //
>        // Use IPv6 minimum link MTU 1280 bytes as the maximum packet size in order
> 


  reply	other threads:[~2020-04-01 12:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01  9:53 [PATCH] NetworkPkg/Ip6Dxe: Fix ASSERT logic in Ip6ProcessRouterAdvertise() Maciej Rabeda
2020-04-01 12:02 ` Laszlo Ersek [this message]
2020-04-01 13:30   ` [edk2-devel] " Maciej Rabeda
2020-04-02  1:15   ` Siyuan, Fu

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=5ab7e131-0d14-a2ef-ec00-caf055f7a862@redhat.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