malloc: use pointer diff macro in IOVA mapping
authorSantosh Shukla <santosh.shukla@caviumnetworks.com>
Fri, 20 Oct 2017 12:31:36 +0000 (18:01 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 6 Nov 2017 21:24:49 +0000 (22:24 +0100)
Use RTE_PTR_DIFF macro in rte_mem_virt2iova api.

Suggested-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
lib/librte_eal/common/rte_malloc.c

index 53057fc..fe2278b 100644 (file)
@@ -262,6 +262,6 @@ rte_malloc_virt2iova(const void *addr)
                iova = (uintptr_t)addr;
        else
                iova = elem->ms->iova +
-                       ((uintptr_t)addr - (uintptr_t)elem->ms->addr);
+                       RTE_PTR_DIFF(addr, elem->ms->addr);
        return iova;
 }