From 8a1c3be8053a7e68328f0c49a1966219c4b46120 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 1 May 2018 21:10:22 +0200 Subject: [PATCH] when allocating as much mem as possible (len=0), the size is not aligned --- lib/librte_mempool/rte_mempool.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index cf5d124ec3..bca9f9cb5c 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -707,11 +707,15 @@ rte_mempool_populate_default(struct rte_mempool *mp) iova, mz->len, rte_mempool_memchunk_mz_free, (void *)(uintptr_t)mz); - else - ret = rte_mempool_populate_virt(mp, mz->addr, - mz->len, pg_sz, + else { + size_t tmp_len; + + tmp_len = RTE_ALIGN_FLOOR(mz->len, pg_sz); + ret = rte_mempool_populate_virt(mp, mz->addr, + tmp_len, pg_sz, rte_mempool_memchunk_mz_free, (void *)(uintptr_t)mz); + } if (ret < 0) { rte_memzone_free(mz); goto fail; -- 2.39.5