aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-07-28 17:55:30 -0400
committerDave Barach <dave@barachs.net>2016-07-28 18:41:31 -0400
commit16ad6ae79fe9eb05684d1ed7b3790249d3595b62 (patch)
tree02785a1c96270bb9bbda2b276bee970366c58d2c /vnet
parentdd3a57f36e0355ff9004e75f03ebac6349978904 (diff)
VPP-189 More coverity bug fixes
Change-Id: I6e9290b26b1e74fc5652b689c8d5cc2972ac11d5 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/af_packet/af_packet.c3
-rw-r--r--vnet/vnet/devices/dpdk/cli.c2
-rw-r--r--vnet/vnet/ethernet/node.c1
-rw-r--r--vnet/vnet/interface_cli.c10
-rw-r--r--vnet/vnet/ip/ip4_forward.c7
5 files changed, 14 insertions, 9 deletions
diff --git a/vnet/vnet/devices/af_packet/af_packet.c b/vnet/vnet/devices/af_packet/af_packet.c
index e3ed3857982..91f3c22d4f2 100644
--- a/vnet/vnet/devices/af_packet/af_packet.c
+++ b/vnet/vnet/devices/af_packet/af_packet.c
@@ -156,7 +156,8 @@ create_packet_v2_sock(u8 * name, tpacket_req_t * rx_req, tpacket_req_t * tx_req,
return 0;
error:
- close(*fd);
+ if (*fd >= 0)
+ close(*fd);
*fd = -1;
return ret;
}
diff --git a/vnet/vnet/devices/dpdk/cli.c b/vnet/vnet/devices/dpdk/cli.c
index 3b0befd55df..c449eebd0a3 100644
--- a/vnet/vnet/devices/dpdk/cli.c
+++ b/vnet/vnet/devices/dpdk/cli.c
@@ -642,7 +642,7 @@ set_dpdk_if_desc (vlib_main_t *vm, unformat_input_t *input,
rv = dpdk_port_setup(dm, xd);
- return rv < 0 ? rv : 0;
+ return rv;
}
VLIB_CLI_COMMAND (cmd_set_dpdk_if_desc,static) = {
diff --git a/vnet/vnet/ethernet/node.c b/vnet/vnet/ethernet/node.c
index 57a699594fc..eae0a2b4c7b 100644
--- a/vnet/vnet/ethernet/node.c
+++ b/vnet/vnet/ethernet/node.c
@@ -76,7 +76,6 @@ vlib_node_registration_t ethernet_input_node;
typedef enum {
ETHERNET_INPUT_VARIANT_ETHERNET,
ETHERNET_INPUT_VARIANT_ETHERNET_TYPE,
- ETHERNET_INPUT_VARIANT_VLAN,
ETHERNET_INPUT_VARIANT_NOT_L2,
} ethernet_input_variant_t;
diff --git a/vnet/vnet/interface_cli.c b/vnet/vnet/interface_cli.c
index d0d75154349..9052f623444 100644
--- a/vnet/vnet/interface_cli.c
+++ b/vnet/vnet/interface_cli.c
@@ -605,15 +605,15 @@ create_sub_interfaces (vlib_main_t * vm,
template.sup_sw_if_index = hi->sw_if_index;
template.sub.id = id;
error = vnet_create_sw_interface (vnm, &template, &sw_if_index);
- if (error) goto done;
+ if (error)
+ goto done;
+
hash_set (hi->sub_interface_sw_if_index_by_id, id, sw_if_index);
hash_set_mem (im->sw_if_index_by_sup_and_sub, kp, sw_if_index);
- vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name, vnet_get_main(), sw_if_index);
+ vlib_cli_output(vm, "%U\n", format_vnet_sw_if_index_name,
+ vnet_get_main(), sw_if_index);
}
- if (error)
- goto done;
-
done:
return error;
}
diff --git a/vnet/vnet/ip/ip4_forward.c b/vnet/vnet/ip/ip4_forward.c
index 6b7fa9b4d05..767cc8f8ce8 100644
--- a/vnet/vnet/ip/ip4_forward.c
+++ b/vnet/vnet/ip/ip4_forward.c
@@ -193,7 +193,12 @@ ip4_fib_set_adj_index (ip4_main_t * im,
fib->new_hash_values);
p = hash_get (hash, dst_address_u32);
- clib_memcpy (p, fib->new_hash_values, vec_bytes (fib->new_hash_values));
+ /* hash_get should never return NULL here */
+ if (p)
+ clib_memcpy (p, fib->new_hash_values,
+ vec_bytes (fib->new_hash_values));
+ else
+ ASSERT(0);
}
}