All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Subject: [PATCH] ivshmem: fix overlap detection code
Date: Tue, 24 May 2016 13:50:05 +0100	[thread overview]
Message-ID: <1464094205-25967-1-git-send-email-anatoly.burakov@intel.com> (raw)

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

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_ivshmem.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

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 = 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;
-- 
2.5.5

             reply	other threads:[~2016-05-24 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 12:50 Anatoly Burakov [this message]
2016-05-24 12:52 ` [PATCH] ivshmem: fix overlap detection code Burakov, Anatoly
2016-05-24 18:31   ` Ferruh Yigit
2016-06-07 10:03     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464094205-25967-1-git-send-email-anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.