[dpdk-dev] [PATCH] mempool: fix the inverted pg_num check on create

Dan Aloni dan at kernelim.com
Sun Aug 16 21:08:19 CEST 2015


The rest of the code expects pg_num <= RTE_DIM(mp->elt_pa).

Signed-off-by: Dan Aloni <dan at kernelim.com>
---
 lib/librte_mempool/rte_mempool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 8e185c545479..edcfa8bf9cb1 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -461,7 +461,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
 	}
 
 	/* Check that pg_num and pg_shift parameters are valid. */
-	if (pg_num < RTE_DIM(mp->elt_pa) || pg_shift > MEMPOOL_PG_SHIFT_MAX) {
+	if (pg_num > RTE_DIM(mp->elt_pa) || pg_shift > MEMPOOL_PG_SHIFT_MAX) {
 		rte_errno = EINVAL;
 		return NULL;
 	}
-- 
2.4.3



More information about the dev mailing list