diff options
author | Dave Barach <dave@barachs.net> | 2016-11-09 11:28:36 -0500 |
---|---|---|
committer | Dave Barach <dave@barachs.net> | 2016-11-09 11:29:58 -0500 |
commit | 8d2e0e02433b0097898c332aa0aeedb34c223a6f (patch) | |
tree | ce77af48df355d3de6bafe4837cc93440e02f5cc | |
parent | 8c83ef01c42ad218ec2803a790625085702cd38a (diff) |
Fix a batch of coverity warnings, VPP-486
Change-Id: I0379844824b4c2eb42588d0fb8e1a7eb441e923f
Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r-- | vlib-api/vlibapi/api_shared.c | 2 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/cli.c | 13 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/init.c | 2 | ||||
-rw-r--r-- | vnet/vnet/ip/ip6_neighbor.c | 3 | ||||
-rw-r--r-- | vpp-api-test/vat/api_format.c | 3 | ||||
-rw-r--r-- | vpp/vpp-api/test_client.c | 2 |
6 files changed, 19 insertions, 6 deletions
diff --git a/vlib-api/vlibapi/api_shared.c b/vlib-api/vlibapi/api_shared.c index c62ac5b18a5..c133922cabd 100644 --- a/vlib-api/vlibapi/api_shared.c +++ b/vlib-api/vlibapi/api_shared.c @@ -847,6 +847,7 @@ vl_msg_api_process_file (vlib_main_t * vm, u8 * filename, if (!cfgp) { vlib_cli_output (vm, "Ugh: msg id %d no trace config\n", msg_id); + munmap (hp, file_size); return; } size = cfgp->size; @@ -872,6 +873,7 @@ vl_msg_api_process_file (vlib_main_t * vm, u8 * filename, if (!cfgp) { vlib_cli_output (vm, "Ugh: msg id %d no trace config\n", msg_id); + munmap (hp, file_size); return; } size = cfgp->size; diff --git a/vnet/vnet/devices/dpdk/cli.c b/vnet/vnet/devices/dpdk/cli.c index 85c3e8038f3..c8a1d067a1c 100644 --- a/vnet/vnet/devices/dpdk/cli.c +++ b/vnet/vnet/devices/dpdk/cli.c @@ -1188,6 +1188,10 @@ set_dpdk_if_hqos_tctbl (vlib_main_t * vm, unformat_input_t * input, /* Detect the set of worker threads */ uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers"); + /* Should never happen, shut up Coverity warning */ + if (p == 0) + return clib_error_return (0, "no worker registrations?"); + vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0]; int worker_thread_first = tr->first_index; int worker_thread_count = tr->count; @@ -1224,6 +1228,10 @@ set_dpdk_if_hqos_pktfield (vlib_main_t * vm, unformat_input_t * input, /* Detect the set of worker threads */ uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers"); + /* Should never happen, shut up Coverity warning */ + if (p == 0) + return clib_error_return (0, "no worker registrations?"); + vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0]; int worker_thread_first = tr->first_index; int worker_thread_count = tr->count; @@ -1426,6 +1434,11 @@ show_dpdk_if_hqos (vlib_main_t * vm, unformat_input_t * input, /* Detect the set of worker threads */ p = hash_get_mem (tm->thread_registrations_by_name, "workers"); + + /* Should never happen, shut up Coverity warning */ + if (p == 0) + return clib_error_return (0, "no worker registrations?"); + tr = (vlib_thread_registration_t *) p[0]; cfg = &devconf->hqos; diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c index e06d6bf2834..ee22b9a2753 100644 --- a/vnet/vnet/devices/dpdk/init.c +++ b/vnet/vnet/devices/dpdk/init.c @@ -739,7 +739,7 @@ dpdk_lib_init (dpdk_main_t * dm) if (devconf->hqos_enabled) { rv = dpdk_port_setup_hqos (xd, &devconf->hqos); - if (rv < 0) + if (rv) return rv; } diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c index 7a63a73c454..5585c95824f 100644 --- a/vnet/vnet/ip/ip6_neighbor.c +++ b/vnet/vnet/ip/ip6_neighbor.c @@ -1063,7 +1063,8 @@ icmp6_neighbor_solicitation_or_advertisement (vlib_main_t * vm, vlib_buffer_advance(p0, - ethernet_buffer_header_size(p0)); eth0 = vlib_buffer_get_current(p0); clib_memcpy(eth0->dst_address, eth0->src_address, 6); - clib_memcpy(eth0->src_address, eth_if0->address, 6); + if (eth_if0) + clib_memcpy(eth0->src_address, eth_if0->address, 6); /* Setup input and output sw_if_index for packet */ ASSERT(vnet_buffer(p0)->sw_if_index[VLIB_RX] == sw_if_index0); diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 120c39c4dba..fb3b2d3757b 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -6325,9 +6325,6 @@ api_mpls_ip_bind_unbind (vat_main_t * vam) /* Wait for a reply... */ W; - - /* Return the good/bad news */ - return (vam->retval); } static int diff --git a/vpp/vpp-api/test_client.c b/vpp/vpp-api/test_client.c index d6192497268..cb265ee5c69 100644 --- a/vpp/vpp-api/test_client.c +++ b/vpp/vpp-api/test_client.c @@ -878,7 +878,7 @@ connect_unix_tap (test_main_t * tm, char *name) mp->_vl_msg_id = ntohs (VL_API_TAP_CONNECT); mp->client_index = tm->my_client_index; mp->context = 0xdeadbeef; - clib_memcpy (mp->tap_name, name, strlen (name)); + strncpy ((char *) mp->tap_name, name, sizeof (mp->tap_name) - 1); mp->use_random_mac = 1; vl_msg_api_send_shmem (tm->vl_input_queue, (u8 *) & mp); } |