From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 8BCB47CEB for ; Fri, 20 Apr 2018 17:11:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:11:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="34892465" Received: from dpdk-xiao-1.sh.intel.com ([10.67.110.178]) by orsmga007.jf.intel.com with ESMTP; 20 Apr 2018 08:11:44 -0700 From: Xiao Wang To: anatoly.burakov@intel.com Cc: dev@dpdk.org, Xiao Wang Date: Fri, 20 Apr 2018 23:10:50 +0800 Message-Id: <20180420151050.36507-1-xiao.w.wang@intel.com> X-Mailer: git-send-email 2.15.1 Subject: [dpdk-dev] [PATCH] vfio: fix boundary check in region search X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Apr 2018 15:11:47 -0000 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 --- 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