From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E89004AC7 for ; Tue, 24 May 2016 14:53:02 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 24 May 2016 05:53:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,359,1459839600"; d="scan'208";a="987645480" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by fmsmga002.fm.intel.com with ESMTP; 24 May 2016 05:53:01 -0700 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by IRSMSX151.ger.corp.intel.com (163.33.192.59) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 24 May 2016 13:53:00 +0100 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.38]) by irsmsx155.ger.corp.intel.com ([169.254.14.240]) with mapi id 14.03.0248.002; Tue, 24 May 2016 13:52:59 +0100 From: "Burakov, Anatoly" To: "Burakov, Anatoly" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] ivshmem: fix overlap detection code Thread-Index: AQHRtbrlGLXDVAkN+0igcRICo6ZpJZ/ICspg Date: Tue, 24 May 2016 12:52:59 +0000 Message-ID: References: <1464094205-25967-1-git-send-email-anatoly.burakov@intel.com> In-Reply-To: <1464094205-25967-1-git-send-email-anatoly.burakov@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGE3YWZjMDYtYmQwNS00NzRkLWFjM2ItYmUxYWU0ZjgxNzg1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjQxNzkxcDg2S2tCVUVEamRHRnhjXC84QzdVclwvM2Y5RW5KbGNFRzZvTW5pdz0ifQ== x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] ivshmem: fix overlap detection code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 May 2016 12:53:03 -0000 > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Anatoly Burakov > Sent: Tuesday, May 24, 2016 1:50 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] ivshmem: fix overlap detection code >=20 > Partial revert of an earlier ill-conceived "fix". > Adjacent segments can never be considered overlapping because we > are not comparing ends to starts, but rather starts to starts. > Therefore the earlier fix was wrong (plus it also had a typo). >=20 > Signed-off-by: Anatoly Burakov > --- > lib/librte_eal/linuxapp/eal/eal_ivshmem.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c > b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c > index 07aec69..eea0314 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c > +++ b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c > @@ -184,21 +184,21 @@ overlap(const struct rte_memzone * mz1, const > struct rte_memzone * mz2) > i_end2 =3D mz2->ioremap_addr + mz2->len; >=20 > /* check for overlap in virtual addresses */ > - if (start1 > start2 && start1 < end2) > + if (start1 >=3D start2 && start1 < end2) > result |=3D VIRT; > if (start2 >=3D start1 && start2 < end1) > result |=3D VIRT; >=20 > /* check for overlap in physical addresses */ > - if (p_start1 > p_start2 && p_start1 < p_end2) > + if (p_start1 >=3D p_start2 && p_start1 < p_end2) > result |=3D PHYS; > - if (p_start2 > p_start1 && p_start2 < p_end1) > + if (p_start2 >=3D p_start1 && p_start2 < p_end1) > result |=3D PHYS; >=20 > /* check for overlap in ioremap addresses */ > - if (i_start1 > i_start2 && i_start1 < i_end2) > + if (i_start1 >=3D i_start2 && i_start1 < i_end2) > result |=3D IOREMAP; > - if (i_start2 > i_start1 && i_start2 < i_end1) > + if (i_start2 >=3D i_start1 && i_start2 < i_end1) > result |=3D IOREMAP; >=20 > return result; > -- > 2.5.5 Apologies, forgot to add: Tested-by: Ferruh Yigit Fixes: d6cf31419e51 ("ivshmem: avoid infinite loop when concatenating segme= nts") Thanks, Anatoly