From 1665d6310dbe461c8f886713dee76f769670f9e4 Mon Sep 17 00:00:00 2001 From: Keith Wiles Date: Sun, 28 Sep 2014 05:28:44 +0000 Subject: [PATCH] mempool: avoid dump crash with null pointer Check the FILE *f and rte_mempool *mp pointers for NULL. Signed-off-by: Keith Wiles Acked-by: Neil Horman --- lib/librte_mempool/rte_mempool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 8f10be8b1c..4cf6c25b45 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -765,6 +765,9 @@ rte_mempool_dump(FILE *f, const struct rte_mempool *mp) unsigned common_count; unsigned cache_count; + RTE_VERIFY(f != NULL); + RTE_VERIFY(mp != NULL); + fprintf(f, "mempool <%s>@%p\n", mp->name, mp); fprintf(f, " flags=%x\n", mp->flags); fprintf(f, " ring=<%s>@%p\n", mp->ring->name, mp->ring); -- 2.20.1