From a5160d7d1f0dda554960e1f0e9f7074bda256baa Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Wed, 13 Mar 2019 15:29:15 -0400 Subject: VPP-1576: fix a set of coverity warnings Change-Id: Ifd34aed8692d5acaa370d4976d974ac573e43705 Signed-off-by: Dave Barach --- src/plugins/ct6/ct6.c | 3 +++ src/plugins/unittest/session_test.c | 3 +++ src/vlib/linux/vmbus.c | 5 ++++- src/vnet/gre/gre.c | 4 ++-- src/vnet/ipsec/ipsec_api.c | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/plugins/ct6/ct6.c b/src/plugins/ct6/ct6.c index dc2b7357d63..a150cbc4381 100644 --- a/src/plugins/ct6/ct6.c +++ b/src/plugins/ct6/ct6.c @@ -196,6 +196,8 @@ static void vl_api_ct6_enable_disable_t_handler ct6_main_t *cmp = &ct6_main; int rv; + VALIDATE_SW_IF_INDEX (mp); + if (mp->is_inside) rv = ct6_in2out_enable_disable (cmp, ntohl (mp->sw_if_index), (int) (mp->enable_disable)); @@ -203,6 +205,7 @@ static void vl_api_ct6_enable_disable_t_handler rv = ct6_out2in_enable_disable (cmp, ntohl (mp->sw_if_index), (int) (mp->enable_disable)); + BAD_SW_IF_INDEX_LABEL; REPLY_MACRO (VL_API_CT6_ENABLE_DISABLE_REPLY); } diff --git a/src/plugins/unittest/session_test.c b/src/plugins/unittest/session_test.c index 5ad6563ed62..fa6a99ffbf0 100644 --- a/src/plugins/unittest/session_test.c +++ b/src/plugins/unittest/session_test.c @@ -1782,6 +1782,9 @@ session_test_mq (vlib_main_t * vm, unformat_input_t * input) options[APP_OPTIONS_EVT_QUEUE_SIZE] = 2048; reg = vl_api_client_index_to_registration (api_index); + /* Shut up coverity */ + if (reg == 0) + abort (); if (!session_main.evt_qs_use_memfd_seg) reg->clib_file_index = VL_API_INVALID_FI; diff --git a/src/vlib/linux/vmbus.c b/src/vlib/linux/vmbus.c index a359c10a71f..d0efbd748ef 100644 --- a/src/vlib/linux/vmbus.c +++ b/src/vlib/linux/vmbus.c @@ -299,7 +299,10 @@ vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr) error = clib_sysfs_write ((char *) s, "%s", netvsc_uuid); if (error) - goto done; + { + close (fd); + goto done; + } uio_new_id_needed = 0; diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c index 364733b4260..028eefbee8b 100644 --- a/src/vnet/gre/gre.c +++ b/src/vnet/gre/gre.c @@ -343,8 +343,8 @@ VLIB_NODE_FN (gre_encap_node) (vlib_main_t * vm, vnet_main_t *vnm = gm->vnet_main; u32 next_index; u32 *from, *to_next, n_left_from, n_left_to_next; - u32 sw_if_index0 = 0; - u32 sw_if_index1 = 0; + u32 sw_if_index0 = ~0; + u32 sw_if_index1 = ~0; adj_index_t adj_index0 = ADJ_INDEX_INVALID; adj_index_t adj_index1 = ADJ_INDEX_INVALID; gre_tunnel_t *gt0 = NULL; diff --git a/src/vnet/ipsec/ipsec_api.c b/src/vnet/ipsec/ipsec_api.c index 33634c9b3a2..906f4c4c16d 100644 --- a/src/vnet/ipsec/ipsec_api.c +++ b/src/vnet/ipsec/ipsec_api.c @@ -342,7 +342,7 @@ static void vl_api_ipsec_sad_entry_add_del_t_handler ipsec_integ_alg_t integ_alg; ipsec_protocol_t proto; ipsec_sa_flags_t flags; - u32 id, spi, sa_index; + u32 id, spi, sa_index = ~0; int rv; #if WITH_LIBSSL > 0 -- cgit 1.2.3-korg