From: Yongseok Koh Date: Tue, 17 Apr 2018 18:39:13 +0000 (-0700) Subject: net/mlx5: fix alignment of memory region X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a2ceae594045b3ce019f601d353f72310a505b3d;p=dpdk.git net/mlx5: fix alignment of memory region The memory region is [start, end), so if the memseg of 'end' isn't allocated yet, the returned memseg will have zero entries and this will make 'end' zero (nil). Fixes: 718e35999c96 ("net/mlx5: use virt2memseg instead of iteration") Signed-off-by: Yongseok Koh Acked-by: Nelio Laranjeiro --- diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c index fdf7b3e882..1b4c7ec5d2 100644 --- a/drivers/net/mlx5/mlx5_mr.c +++ b/drivers/net/mlx5/mlx5_mr.c @@ -265,10 +265,7 @@ mlx5_mr_new(struct rte_eth_dev *dev, struct rte_mempool *mp) ms = rte_mem_virt2memseg((void *)start, NULL); if (ms != NULL) start = RTE_ALIGN_FLOOR(start, ms->hugepage_sz); - ms = rte_mem_virt2memseg((void *)end, NULL); - if (ms != NULL) - end = RTE_ALIGN_CEIL(end, ms->hugepage_sz); - + end = RTE_ALIGN_CEIL(end, ms->hugepage_sz); DRV_LOG(DEBUG, "port %u mempool %p using start=%p end=%p size=%zu for memory" " region",