[dpdk-dev] [PATCH] vfio: fix boundary check in region search

Xiao Wang xiao.w.wang at intel.com
Fri Apr 20 17:10:50 CEST 2018


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 at 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



More information about the dev mailing list