From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.6084.1585898491050546309 for ; Fri, 03 Apr 2020 00:21:31 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: jiaxin.wu@intel.com) IronPort-SDR: BZ2WM9cW8kBVv3c+PmcwwuwOIwQSP+MlcQHiv5fwjbHqYh2UEDCxmXSi/eDOQTCPtJR5ad8vhx 2g1R5bK0XOMw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Apr 2020 00:21:30 -0700 IronPort-SDR: sPCw85XSAGOgrEWwPgKiCl5OgphSU0FA7eiHD6IBAMHG/ZlU5EJEI0Zm01SWlG3xQ+9/jJwm+6 /TxhOcfnIEBw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,338,1580803200"; d="scan'208";a="295918086" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 03 Apr 2020 00:21:30 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Apr 2020 00:21:30 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 3 Apr 2020 00:21:30 -0700 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.191]) by shsmsx102.ccr.corp.intel.com ([169.254.2.138]) with mapi id 14.03.0439.000; Fri, 3 Apr 2020 15:21:26 +0800 From: "Wu, Jiaxin" To: Maciej Rabeda , "devel@edk2.groups.io" CC: "Fu, Siyuan" , Laszlo Ersek Subject: Re: [PATCH v2] NetworkPkg/Ip6Dxe: Fix ASSERT logic in Ip6ProcessRouterAdvertise() Thread-Topic: [PATCH v2] NetworkPkg/Ip6Dxe: Fix ASSERT logic in Ip6ProcessRouterAdvertise() Thread-Index: AQHWCM8lhjcf/sdeDkWp9jZcZcbsrahm/0Og Date: Fri, 3 Apr 2020 07:21:25 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B727417061717@SHSMSX107.ccr.corp.intel.com> References: <20200402091434.1668-1-maciej.rabeda@linux.intel.com> In-Reply-To: <20200402091434.1668-1-maciej.rabeda@linux.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmI2MmIyODMtMzhjNC00MDlhLWE0MTAtYjBkN2U3MTZiNmM4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoienJhNXVPcDVZVUdFOVwvZFVvNEdcL0kxbzFGT3BudzNFaVBvd0JPZHV3M2pRUGpxSlhtWXM5N1wvMmVDdUVBcDE4MCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: jiaxin.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiaxin Wu > -----Original Message----- > From: Maciej Rabeda > Sent: Thursday, April 2, 2020 5:15 PM > To: devel@edk2.groups.io > Cc: Wu, Jiaxin ; Fu, Siyuan ; > Laszlo Ersek > Subject: [PATCH v2] NetworkPkg/Ip6Dxe: Fix ASSERT logic in > Ip6ProcessRouterAdvertise() >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2655 >=20 > This patch fixes reversed logic of recently added ASSERTs which should > ensure that Ip6IsNDOptionValid() implementation properly reacts to invali= d > packets. >=20 > Cc: Jiaxin Wu > Cc: Siyuan Fu > Signed-off-by: Maciej Rabeda > Reviewed-by: Siyuan Fu > Tested-by: Laszlo Ersek > Fixes: 9c20342eed70ec99ec50cd73cb81804299f05403 > --- > NetworkPkg/Ip6Dxe/Ip6Nd.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > 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(). >=20 > // >=20 > ASSERT (LinkLayerOption.Length !=3D 0); >=20 > - ASSERT (Offset + (UINT32) LinkLayerOption.Length * 8 >=3D (UINT32)= Head- > >PayloadLength); >=20 > + ASSERT (Offset + (UINT32) LinkLayerOption.Length * 8 <=3D (UINT32) > Head->PayloadLength); >=20 >=20 >=20 > ZeroMem (&LinkLayerAddress, sizeof (EFI_MAC_ADDRESS)); >=20 > CopyMem (&LinkLayerAddress, LinkLayerOption.EtherAddr, 6); >=20 > @@ -2164,7 +2164,7 @@ Ip6ProcessRouterAdvertise ( > // Option size validity ensured by Ip6IsNDOptionValid(). >=20 > // >=20 > ASSERT (PrefixOption.Length =3D=3D 4); >=20 > - ASSERT (Offset + (UINT32) PrefixOption.Length * 8 >=3D (UINT32) He= ad- > >PayloadLength); >=20 > + ASSERT (Offset + (UINT32) PrefixOption.Length * 8 <=3D (UINT32) He= ad- > >PayloadLength); >=20 >=20 >=20 > PrefixOption.ValidLifetime =3D NTOHL (PrefixOption.ValidLifeti= me); >=20 > PrefixOption.PreferredLifetime =3D NTOHL > (PrefixOption.PreferredLifetime); >=20 > @@ -2334,7 +2334,7 @@ Ip6ProcessRouterAdvertise ( > // Option size validity ensured by Ip6IsNDOptionValid(). >=20 > // >=20 > ASSERT (MTUOption.Length =3D=3D 1); >=20 > - ASSERT (Offset + (UINT32) MTUOption.Length * 8 >=3D (UINT32) Head- > >PayloadLength); >=20 > + ASSERT (Offset + (UINT32) MTUOption.Length * 8 <=3D (UINT32) Head- > >PayloadLength); >=20 >=20 >=20 > // >=20 > // Use IPv6 minimum link MTU 1280 bytes as the maximum packet size= in > order >=20 > -- > 2.24.0.windows.2