From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web10.5943.1589944240501750290 for ; Tue, 19 May 2020 20:10:40 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: shenglei.zhang@intel.com) IronPort-SDR: rzEv0IaReBoWjKTgB9fz0Qipwl5XcP9ami5SuTM25wHCR90gX0WZbZ8LmGV77XSSqmN3rufoOG Fvta3jUH2L9w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 20:10:39 -0700 IronPort-SDR: 2F5IyMyxl8HqcSb1pBCK5Cm40D3zuogJSiIkaF+TkmGB/ueSSFMkDrbxCDnWbYC7nTrHGgnBYt CMWFzH2nc0wQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,412,1583222400"; d="scan'208";a="289200776" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 19 May 2020 20:10:39 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 19 May 2020 20:10:39 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 19 May 2020 20:10:39 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 19 May 2020 20:10:38 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.181]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.178]) with mapi id 14.03.0439.000; Wed, 20 May 2020 11:10:35 +0800 From: "Zhang, Shenglei" To: "devel@edk2.groups.io" , "Zhang, Shenglei" , "Gao, Liming" CC: Maciej Rabeda , "Fu, Siyuan" , "Wu, Jiaxin" Subject: Re: [edk2-devel] [PATCH v2] NetworkPkg/DxeNetLib: Change the order of conditions in IF statement Thread-Topic: [edk2-devel] [PATCH v2] NetworkPkg/DxeNetLib: Change the order of conditions in IF statement Thread-Index: AQHWLlQGnDZHN0HSykCHJWeP2lMAk6iwS5FQ Date: Wed, 20 May 2020 03:10:35 +0000 Message-ID: References: <16109DC42FE5E79D.3891@groups.io> In-Reply-To: <16109DC42FE5E79D.3891@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: shenglei.zhang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, For this patch, I'd like to catch this stable tag. Thanks, Shenglei > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Zhang, Shenglei > Sent: Wednesday, May 20, 2020 11:09 AM > To: devel@edk2.groups.io > Cc: Maciej Rabeda ; Fu, Siyuan > ; Wu, Jiaxin > Subject: [edk2-devel] [PATCH v2] NetworkPkg/DxeNetLib: Change the order > of conditions in IF statement >=20 > The condition, NET_HEADSPACE(&(Nbuf->BlockOp[Index])) < Len, is > meaningless if Index =3D 0. So checking 'Index !=3D 0' should be > performed first in the if statement. >=20 > Cc: Maciej Rabeda > Cc: Siyuan Fu > Cc: Jiaxin Wu > Signed-off-by: Shenglei Zhang > --- >=20 > v2: Update 'Index > 0' to 'Index !=3D 0' >=20 > NetworkPkg/Library/DxeNetLib/NetBuffer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/NetworkPkg/Library/DxeNetLib/NetBuffer.c > b/NetworkPkg/Library/DxeNetLib/NetBuffer.c > index a232802c9a21..329a17623d94 100644 > --- a/NetworkPkg/Library/DxeNetLib/NetBuffer.c > +++ b/NetworkPkg/Library/DxeNetLib/NetBuffer.c > @@ -1063,7 +1063,7 @@ NetbufAllocSpace ( > } else { > NetbufGetByte (Nbuf, 0, &Index); >=20 > - if ((NET_HEADSPACE(&(Nbuf->BlockOp[Index])) < Len) && (Index > 0)= ) { > + if ((Index !=3D 0) && (NET_HEADSPACE(&(Nbuf->BlockOp[Index])) < L= en)) > { > Index--; > } > } > -- > 2.18.0.windows.1 >=20 >=20 >=20