summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/buffer.c
diff options
context:
space:
mode:
authorLijian.Zhang <Lijian.Zhang@arm.com>2019-04-03 16:32:30 +0800
committerDamjan Marion <dmarion@me.com>2019-06-18 10:11:02 +0000
commita8c0b62a88494e9a8562c57dfd3fd75818a629a7 (patch)
treef15ff6a61b40ee893d504237e0a7c003e39853bd /src/plugins/dpdk/buffer.c
parent376efe5df22dcb381fd687a0986f85035c38bed5 (diff)
dpdk: check result of rte_mempool_create_empty
Check the returned pointer, report error and return in case of failure. This avoids crashing without any useful clues or debug messages. Type: fix Change-Id: I15d0735a531c2d9a8b6f67b7d6fe326b98c963c3 Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com> Reviewed-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
Diffstat (limited to 'src/plugins/dpdk/buffer.c')
-rw-r--r--src/plugins/dpdk/buffer.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index dd7bf4cc9d1..6add0630d85 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -55,6 +55,13 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
mp = rte_mempool_create_empty ((char *) name, vec_len (bp->buffers),
elt_size, 512, sizeof (priv),
bp->numa_node, 0);
+ if (!mp)
+ {
+ vec_free (name);
+ return clib_error_return (0,
+ "failed to create normal mempool for numa node %u",
+ bp->index);
+ }
vec_reset_length (name);
/* non-cached mempool */
@@ -62,6 +69,14 @@ dpdk_buffer_pool_init (vlib_main_t * vm, vlib_buffer_pool_t * bp)
nmp = rte_mempool_create_empty ((char *) name, vec_len (bp->buffers),
elt_size, 0, sizeof (priv),
bp->numa_node, 0);
+ if (!nmp)
+ {
+ rte_mempool_free (mp);
+ vec_free (name);
+ return clib_error_return (0,
+ "failed to create non-cache mempool for numa nude %u",
+ bp->index);
+ }
vec_free (name);
dpdk_mempool_by_buffer_pool_index[bp->index] = mp;