From 8554f8adcc97b10eee674762307bfb2ede76d722 Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 8 Jan 2018 09:24:04 -0800 Subject: memif: fix coverity divide by zero Coverity complains about divide by zero if tx_queues gets the value of 0 from the macro vec_len(). While we don't anticipate such condition to happen, programming errors may exist. To defend against divide by zero, crash and burn if tx_queues gets a value of 0. Change-Id: I65e014c07e9d4adfe119d5b373b5dc24cb818a03 Signed-off-by: Steven --- src/plugins/memif/device.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins') diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c index 5f670563fcb..3809061e434 100644 --- a/src/plugins/memif/device.c +++ b/src/plugins/memif/device.c @@ -176,6 +176,7 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (tx_queues < vec_len (vlib_mains)) { + ASSERT (tx_queues > 0); qid = thread_index % tx_queues; clib_spinlock_lock_if_init (&mif->lockp); } -- cgit 1.2.3-korg