aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-08-10 16:56:16 -0400
committerDave Barach <dave@barachs.net>2016-08-10 16:56:32 -0400
commitdd522cbaf421de7b34887fb8c33981c4ebca9201 (patch)
tree79dab4a6a205d683b77e21f92514923c952195e0 /vnet
parent839fe3e6d65dbbd7cd102a22a7259d2556b7410a (diff)
VPP-189 Fix coverity warnings
Change-Id: Iea6d338e60a95f7f30c10c2e751d4827e816f700 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/devices/dpdk/cli.c2
-rw-r--r--vnet/vnet/devices/dpdk/device.c6
-rw-r--r--vnet/vnet/devices/dpdk/format.c5
-rw-r--r--vnet/vnet/devices/dpdk/init.c24
-rw-r--r--vnet/vnet/devices/netmap/device.c17
-rw-r--r--vnet/vnet/devices/netmap/node.c18
-rw-r--r--vnet/vnet/l2/l2_input_acl.c2
7 files changed, 51 insertions, 23 deletions
diff --git a/vnet/vnet/devices/dpdk/cli.c b/vnet/vnet/devices/dpdk/cli.c
index c449eebd0a3..a40dcc7c9ad 100644
--- a/vnet/vnet/devices/dpdk/cli.c
+++ b/vnet/vnet/devices/dpdk/cli.c
@@ -332,7 +332,7 @@ show_efd (vlib_main_t * vm,
dpdk_device_t * xd;
u32 device_id = ~0;
- unformat(input, "device %d", &device_id);
+ (void) unformat(input, "device %d", &device_id);
vec_foreach (xd, dm->devices) {
if ((xd->device_index == device_id) || (device_id == ~0)) {
show_dpdk_device_stats(vm, xd);
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c
index 66d4b6d4eed..61774f0f3e2 100644
--- a/vnet/vnet/devices/dpdk/device.c
+++ b/vnet/vnet/devices/dpdk/device.c
@@ -1028,7 +1028,11 @@ dpdk_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
else
{
xd->admin_up = 0;
- rte_kni_release(xd->kni);
+ int kni_rv;
+
+ kni_rv = rte_kni_release(xd->kni);
+ if (kni_rv < 0)
+ clib_warning ("rte_kni_release returned %d", kni_rv);
}
return 0;
}
diff --git a/vnet/vnet/devices/dpdk/format.c b/vnet/vnet/devices/dpdk/format.c
index 4c553655db6..2d41221d247 100644
--- a/vnet/vnet/devices/dpdk/format.c
+++ b/vnet/vnet/devices/dpdk/format.c
@@ -400,9 +400,12 @@ u8 * format_dpdk_device (u8 * s, va_list * args)
struct rte_pci_device * pci;
struct rte_eth_rss_conf rss_conf;
int vlan_off;
+ int retval;
rss_conf.rss_key = 0;
- rte_eth_dev_rss_hash_conf_get(xd->device_index, &rss_conf);
+ retval = rte_eth_dev_rss_hash_conf_get(xd->device_index, &rss_conf);
+ if (retval < 0)
+ clib_warning ("rte_eth_dev_rss_hash_conf_get returned %d", retval);
pci = di.pci_dev;
if (pci)
diff --git a/vnet/vnet/devices/dpdk/init.c b/vnet/vnet/devices/dpdk/init.c
index 1f4629dafc6..b690dec2732 100644
--- a/vnet/vnet/devices/dpdk/init.c
+++ b/vnet/vnet/devices/dpdk/init.c
@@ -119,7 +119,11 @@ dpdk_port_setup (dpdk_main_t * dm, dpdk_device_t * xd)
}
if (xd->admin_up) {
- rte_eth_dev_start (xd->device_index);
+ int rv;
+ rv = rte_eth_dev_start (xd->device_index);
+ if (rv < 0)
+ clib_warning ("rte_eth_dev_start %d returned %d",
+ xd->device_index, rv);
}
return 0;
}
@@ -189,7 +193,12 @@ static u32 dpdk_flag_change (vnet_main_t * vnm,
rte_eth_dev_set_mtu(xd->device_index, hi->max_packet_bytes);
if (xd->admin_up)
- rte_eth_dev_start (xd->device_index);
+ {
+ int rv = rte_eth_dev_start (xd->device_index);
+ if (rv < 0)
+ clib_warning ("rte_eth_dev_start %d returned %d",
+ xd->device_index, rv);
+ }
}
}
return old;
@@ -391,7 +400,8 @@ dpdk_lib_init (dpdk_main_t * dm)
if (!xd->pmd) {
-#define _(s,f) else if (!strcmp(dev_info.driver_name, s)) \
+#define _(s,f) else if (dev_info.driver_name && \
+ !strcmp(dev_info.driver_name, s)) \
xd->pmd = VNET_DPDK_PMD_##f;
if (0)
;
@@ -651,7 +661,7 @@ dpdk_lib_init (dpdk_main_t * dm)
rv = dpdk_port_setup(dm, xd);
- if (rv < 0)
+ if (rv)
return rv;
/* count the number of descriptors used for this device */
@@ -1199,6 +1209,12 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
vec_free(p);
vec_free(path);
}));
+
+ if (mem_by_socket == 0)
+ {
+ error = clib_error_return (0, "mem_by_socket NULL");
+ goto done;
+ }
_vec_len (mem_by_socket) = c + 1;
/* regenerate socket_mem string */
diff --git a/vnet/vnet/devices/netmap/device.c b/vnet/vnet/devices/netmap/device.c
index a13326035de..751caf72aa8 100644
--- a/vnet/vnet/devices/netmap/device.c
+++ b/vnet/vnet/devices/netmap/device.c
@@ -119,14 +119,15 @@ netmap_interface_tx (vlib_main_t * vm,
if (nm_tx_pending(ring))
{
- ioctl(nif->fd, NIOCTXSYNC, NULL);
- clib_cpu_time_wait(time_constant);
-
- if (nm_tx_pending(ring) && !n_free_slots)
- {
- cur_ring++;
- continue;
- }
+ if (ioctl(nif->fd, NIOCTXSYNC, NULL) < 0)
+ clib_unix_warning ("NIOCTXSYNC");
+ clib_cpu_time_wait(time_constant);
+
+ if (nm_tx_pending(ring) && !n_free_slots)
+ {
+ cur_ring++;
+ continue;
+ }
}
while (n_left && n_free_slots)
diff --git a/vnet/vnet/devices/netmap/node.c b/vnet/vnet/devices/netmap/node.c
index 9378dfd95bb..4a79fe0f979 100644
--- a/vnet/vnet/devices/netmap/node.c
+++ b/vnet/vnet/devices/netmap/node.c
@@ -210,13 +210,17 @@ netmap_device_input_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
VLIB_BUFFER_TRACE_TRAJECTORY_INIT(first_b0);
if (PREDICT_FALSE(n_trace > 0))
{
- netmap_input_trace_t *tr;
- vlib_trace_buffer (vm, node, next0, first_b0, /* follow_chain */ 0);
- vlib_set_trace_count (vm, node, --n_trace);
- tr = vlib_add_trace (vm, node, first_b0, sizeof (*tr));
- tr->next_index = next0;
- tr->hw_if_index = nif->hw_if_index;
- memcpy (&tr->slot, slot, sizeof (struct netmap_slot));
+ if (PREDICT_TRUE(first_b0 != 0))
+ {
+ netmap_input_trace_t *tr;
+ vlib_trace_buffer (vm, node, next0, first_b0,
+ /* follow_chain */ 0);
+ vlib_set_trace_count (vm, node, --n_trace);
+ tr = vlib_add_trace (vm, node, first_b0, sizeof (*tr));
+ tr->next_index = next0;
+ tr->hw_if_index = nif->hw_if_index;
+ memcpy (&tr->slot, slot, sizeof (struct netmap_slot));
+ }
}
/* enque and take next packet */
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_next,
diff --git a/vnet/vnet/l2/l2_input_acl.c b/vnet/vnet/l2/l2_input_acl.c
index d3038e8df1e..f8e77d7e58f 100644
--- a/vnet/vnet/l2/l2_input_acl.c
+++ b/vnet/vnet/l2/l2_input_acl.c
@@ -329,7 +329,7 @@ l2_inacl_node_fn (vlib_main_t * vm,
t->sw_if_index = vnet_buffer(b0)->sw_if_index[VLIB_RX];
t->next_index = next0;
t->table_index = t0 ? t0 - vcm->tables : ~0;
- t->offset = e0 ? vnet_classify_get_offset (t0, e0): ~0;
+ t->offset = (t0 && e0) ? vnet_classify_get_offset (t0, e0): ~0;
}
/* verify speculative enqueue, maybe switch current next frame */