Skip to contentSkip to conversation

ivshmem: fix overlap detection code

PATCH Applied Anatoly Burakov 3 participants 4 messages May 24, 2016 – Jun 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ivshmem: fix overlap detection code

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).

---
 lib/librte_eal/linuxapp/eal/eal_ivshmem.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
lib/librte_eal/linuxapp/eal/eal_ivshmem.c +5 -5
index 07aec69..eea0314 100644
@@ -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;
Signature · 1 line
2.5.5
author Tested-by Ferruh Yigit on v1 1/1
#1 lore raw
Quoted 47 lines

From: dev [mailto:[email protected]] On Behalf Of Anatoly Burakov
Sent: Tuesday, May 24, 2016 1:50 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] ivshmem: fix overlap detection code

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).

---
 lib/librte_eal/linuxapp/eal/eal_ivshmem.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
lib/librte_eal/linuxapp/eal/eal_ivshmem.c +5 -5
index 07aec69..eea0314 100644
@@ -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;
 
Quoted 3 lines

return result;
--
2.5.5

Apologies, forgot to add:

Fixes d6cf31419e51 ("ivshmem: avoid infinite loop when concatenating segments")

Thanks,
Anatoly

Acked-by
#2 lore raw
Quoted 10 lines · Anatoly
Quoted 10 lines

From: dev [mailto:[email protected]] On Behalf Of Anatoly Burakov
Sent: Tuesday, May 24, 2016 1:50 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] ivshmem: fix overlap detection code

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).

Quoted 5 lines
Quoted 1 line
Fixes d6cf31419e51 ("ivshmem: avoid infinite loop when concatenating segments")
#3 lore raw

2016-05-24 19:31, Ferruh Yigit:

Quoted 11 lines · Anatoly
Quoted 10 lines
Quoted 10 lines

From: dev [mailto:[email protected]] On Behalf Of Anatoly Burakov
Sent: Tuesday, May 24, 2016 1:50 PM
To: [email protected]
Subject: [dpdk-dev] [PATCH] ivshmem: fix overlap detection code

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).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Fixes d6cf31419e51 ("ivshmem: avoid infinite loop when concatenating segments")

Applied, thanks