diff options
author | Steven <sluong@cisco.com> | 2018-01-08 09:24:04 -0800 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2018-01-09 20:20:13 +0000 |
commit | 8554f8adcc97b10eee674762307bfb2ede76d722 (patch) | |
tree | 4151f47bfd47bb069a87346576c54b889fbada03 /src/plugins/memif | |
parent | 6f1e8b9947ec23b524f340da035c37c07938c268 (diff) |
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 <sluong@cisco.com>
Diffstat (limited to 'src/plugins/memif')
-rw-r--r-- | src/plugins/memif/device.c | 1 |
1 files changed, 1 insertions, 0 deletions
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); } |