From 8d2e0e02433b0097898c332aa0aeedb34c223a6f Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Wed, 9 Nov 2016 11:28:36 -0500 Subject: Fix a batch of coverity warnings, VPP-486 Change-Id: I0379844824b4c2eb42588d0fb8e1a7eb441e923f Signed-off-by: Dave Barach --- vnet/vnet/devices/dpdk/cli.c | 13 +++++++++++++ vnet/vnet/devices/dpdk/init.c | 2 +- vnet/vnet/ip/ip6_neighbor.c | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'vnet') 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); -- cgit 1.2.3-korg