when allocating as much mem as possible (len=0), the size is not aligned
authorroot <root@ubuntu1604.vm.6wind.com>
Tue, 1 May 2018 19:10:22 +0000 (21:10 +0200)
committerOlivier Matz <olivier.matz@6wind.com>
Tue, 1 May 2018 19:20:20 +0000 (21:20 +0200)
lib/librte_mempool/rte_mempool.c

index cf5d124..bca9f9c 100644 (file)
@@ -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;