From: Xiao Wang <xiao.w.wang@intel.com>
To: anatoly.burakov@intel.com
Cc: dev@dpdk.org, Xiao Wang <xiao.w.wang@intel.com>
Subject: [dpdk-dev] [PATCH] vfio: fix boundary check in region search
Date: Fri, 20 Apr 2018 23:10:50 +0800 [thread overview]
Message-ID: <20180420151050.36507-1-xiao.w.wang@intel.com> (raw)
A previously mapped region is skipped during the search, leading to
DMA unmap fails.
This patch fixes it and rewords the comment.
Fixes: 73a639085938 ("vfio: allow to map other memory regions")
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
lib/librte_eal/linuxapp/eal/eal_vfio.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index 7cf3f0285..7afa33d3a 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -230,15 +230,15 @@ find_user_mem_map(struct user_mem_maps *user_mem_maps, uint64_t addr,
/* check start VA */
if (addr < map->addr || addr >= map_va_end)
continue;
- /* check if IOVA end is within boundaries */
- if (va_end <= map->addr || va_end >= map_va_end)
+ /* check if VA end is within boundaries */
+ if (va_end <= map->addr || va_end > map_va_end)
continue;
- /* check start PA */
+ /* check start IOVA */
if (iova < map->iova || iova >= map_iova_end)
continue;
/* check if IOVA end is within boundaries */
- if (iova_end <= map->iova || iova_end >= map_iova_end)
+ if (iova_end <= map->iova || iova_end > map_iova_end)
continue;
/* we've found our map */
--
2.15.1
next reply other threads:[~2018-04-20 15:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 15:10 Xiao Wang [this message]
2018-04-20 15:23 ` Burakov, Anatoly
2018-04-23 19:26 ` 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=20180420151050.36507-1-xiao.w.wang@intel.com \
--to=xiao.w.wang@intel.com \
--cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).