From: Anatoly Burakov Date: Tue, 24 May 2016 12:50:05 +0000 (+0100) Subject: ivshmem: fix overlap detection X-Git-Tag: spdx-start~6838 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a2113ebba5c5bad6568dcebb9b2bc50027d4affd;p=dpdk.git ivshmem: fix overlap detection 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). Fixes: d6cf31419e51 ("ivshmem: avoid infinite loop when concatenating segments") Signed-off-by: Anatoly Burakov Tested-by: Ferruh Yigit Acked-by: Ferruh Yigit --- diff --git a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c index 07aec694f4..eea0314b5f 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 = mz2->ioremap_addr + mz2->len; /* check for overlap in virtual addresses */ - if (start1 > start2 && start1 < end2) + if (start1 >= start2 && start1 < end2) result |= VIRT; if (start2 >= start1 && start2 < end1) result |= VIRT; /* check for overlap in physical addresses */ - if (p_start1 > p_start2 && p_start1 < p_end2) + if (p_start1 >= p_start2 && p_start1 < p_end2) result |= PHYS; - if (p_start2 > p_start1 && p_start2 < p_end1) + if (p_start2 >= p_start1 && p_start2 < p_end1) result |= PHYS; /* check for overlap in ioremap addresses */ - if (i_start1 > i_start2 && i_start1 < i_end2) + if (i_start1 >= i_start2 && i_start1 < i_end2) result |= IOREMAP; - if (i_start2 > i_start1 && i_start2 < i_end1) + if (i_start2 >= i_start1 && i_start2 < i_end1) result |= IOREMAP; return result;