diff options
author | 2016-11-09 11:28:36 -0500 | |
---|---|---|
committer | 2016-11-09 11:29:58 -0500 | |
commit | 8d2e0e02433b0097898c332aa0aeedb34c223a6f (patch) | |
tree | ce77af48df355d3de6bafe4837cc93440e02f5cc /vnet | |
parent | 8c83ef01c42ad218ec2803a790625085702cd38a (diff) |
Fix a batch of coverity warnings, VPP-486
Change-Id: I0379844824b4c2eb42588d0fb8e1a7eb441e923f
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet')
-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 |
3 files changed, 16 insertions, 2 deletions
diff --git a/vnet/vnet/devices/dpdk/cli.c b/vnet/vnet/devices/dpdk/cli.c index 85c3e803..c8a1d067 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 e06d6bf2..ee22b9a2 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 7a63a73c..5585c958 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); |