From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web10.4752.1585742553990925701 for ; Wed, 01 Apr 2020 05:02:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LEZ6NDHK; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585742553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cgPGUjJns9Dflcg4vmD+0mx2bwf+dH97guo89sSoN1s=; b=LEZ6NDHKgGwGE6u98MNpL/DZOrAYsfMGPlWI/SpvvcXpfViJ4xRVAcmoLsGiEQi2Adyqo4 DfgSd9Gq37yXatnEmkQuuV8EVaV3TpFwsQhi/1a+zpJdmajNC9l8EJTThwWB0QzbYIQU2z DkYQgzctLFN66dY+JQIJzIw2ma5UrMk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-174-CayJdxT0McWIBChT7N0hfg-1; Wed, 01 Apr 2020 08:02:31 -0400 X-MC-Unique: CayJdxT0McWIBChT7N0hfg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 67BD3189F78A; Wed, 1 Apr 2020 12:02:30 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-94.ams2.redhat.com [10.36.114.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DBE510190A0; Wed, 1 Apr 2020 12:02:29 +0000 (UTC) Subject: Re: [PATCH] NetworkPkg/Ip6Dxe: Fix ASSERT logic in Ip6ProcessRouterAdvertise() To: Maciej Rabeda , devel@edk2.groups.io Cc: Jiaxin Wu , Siyuan Fu References: <20200401095321.1966-1-maciej.rabeda@linux.intel.com> From: "Laszlo Ersek" Message-ID: <5ab7e131-0d14-a2ef-ec00-caf055f7a862@redhat.com> Date: Wed, 1 Apr 2020 14:02:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200401095321.1966-1-maciej.rabeda@linux.intel.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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 > Cc: Siyuan Fu > Signed-off-by: Maciej Rabeda > Tested-by: Laszlo Ersek > --- > 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 >