aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-08-08 13:05:31 -0400
committerDave Barach <dave@barachs.net>2016-08-08 13:09:15 -0400
commit6f6f34f620a18638eb820a9ab3d8a93e350d722a (patch)
treef0e03e0a2e96b10511561e5868a4ff741a9386f4 /vnet
parent06e3d075760be43dbd61385d3c7861cd5fe44af2 (diff)
VPP-189 Clean up more coverity warnings
Change-Id: If66713d79c545c762c385faf08cc809347741152 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/ip/ip4_mtrie.c2
-rw-r--r--vnet/vnet/ip/ip6_neighbor.c8
-rw-r--r--vnet/vnet/map/ip4_map_t.c3
-rw-r--r--vnet/vnet/sr/sr_replicate.c3
-rw-r--r--vnet/vnet/unix/tuntap.c8
5 files changed, 14 insertions, 10 deletions
diff --git a/vnet/vnet/ip/ip4_mtrie.c b/vnet/vnet/ip/ip4_mtrie.c
index 0badde769c2..006610a0f4e 100644
--- a/vnet/vnet/ip/ip4_mtrie.c
+++ b/vnet/vnet/ip/ip4_mtrie.c
@@ -303,7 +303,7 @@ unset_leaf (ip4_fib_mtrie_t * m,
{
ip4_fib_mtrie_leaf_t old_leaf, del_leaf;
i32 n_dst_bits_next_plies;
- uword i, n_dst_bits_this_ply, old_leaf_is_terminal;
+ i32 i, n_dst_bits_this_ply, old_leaf_is_terminal;
u8 dst_byte;
ASSERT (a->dst_address_length > 0 && a->dst_address_length <= 32);
diff --git a/vnet/vnet/ip/ip6_neighbor.c b/vnet/vnet/ip/ip6_neighbor.c
index 2593cb46156..1dd09c11052 100644
--- a/vnet/vnet/ip/ip6_neighbor.c
+++ b/vnet/vnet/ip/ip6_neighbor.c
@@ -1437,7 +1437,8 @@ icmp6_router_advertisement(vlib_main_t * vm,
/* check for MTU or prefix options or .. */
u8 * opt_hdr = (u8 *)(h0 + 1);
- while( options_len0 > 0)
+ while( options_len0 > 0 &&
+ opt_hdr < p0->data + p0->current_data)
{
icmp6_neighbor_discovery_option_header_t *o0 = ( icmp6_neighbor_discovery_option_header_t *)opt_hdr;
int opt_len = o0->n_data_u64s << 3;
@@ -1666,11 +1667,10 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
a->min_delay_between_radv = MIN_DELAY_BETWEEN_RAS;
a->max_delay_between_radv = MAX_DELAY_BETWEEN_RAS;
a->max_rtr_default_lifetime = MAX_DEF_RTR_LIFETIME;
- a->seed = random_default_seed();
+ a->seed = (u32) (clib_cpu_time_now() & 0xFFFFFFFF);
/* for generating random interface ids */
- a->randomizer = 0x1119194911191949;
- a->randomizer = random_u64 ((u32 *)&a->randomizer);
+ a->randomizer = random_u64 (&a->seed);
a->initial_adverts_count = MAX_INITIAL_RTR_ADVERTISEMENTS ;
a->initial_adverts_sent = a->initial_adverts_count-1;
diff --git a/vnet/vnet/map/ip4_map_t.c b/vnet/vnet/map/ip4_map_t.c
index f4bae608e4d..6c3a80cc5f3 100644
--- a/vnet/vnet/map/ip4_map_t.c
+++ b/vnet/vnet/map/ip4_map_t.c
@@ -376,7 +376,8 @@ _ip4_map_t_icmp (map_domain_t * d, vlib_buffer_t * p, u8 * error)
}
else
{
- ASSERT (0); // We had a port from that, so it is udp or tcp or ICMP
+ /* To shut up Coverity */
+ os_panic();
}
//FIXME: Security check with the port found in the inner packet
diff --git a/vnet/vnet/sr/sr_replicate.c b/vnet/vnet/sr/sr_replicate.c
index b3fc3edaa4f..8a51fdb882d 100644
--- a/vnet/vnet/sr/sr_replicate.c
+++ b/vnet/vnet/sr/sr_replicate.c
@@ -357,7 +357,8 @@ sr_replicate_node_fn (vlib_main_t * vm,
(hdr_ip0->payload_length);
}
tr->next_index = next_index;
- memcpy (tr->sr, hdr_sr0, sizeof (tr->sr));
+ if (hdr_sr0)
+ memcpy (tr->sr, hdr_sr0, sizeof (tr->sr));
}
}
diff --git a/vnet/vnet/unix/tuntap.c b/vnet/vnet/unix/tuntap.c
index f24d71eee8a..967c0aca4ac 100644
--- a/vnet/vnet/unix/tuntap.c
+++ b/vnet/vnet/unix/tuntap.c
@@ -428,8 +428,9 @@ tuntap_exit (vlib_main_t * vm)
clib_unix_warning ("TUNSETPERSIST");
close(tm->dev_tap_fd);
if (tm->dev_net_tun_fd >= 0)
- close(tm->dev_net_tun_fd);
- close (sfd);
+ close(tm->dev_net_tun_fd);
+ if (sfd >= 0)
+ close (sfd);
return 0;
}
@@ -792,7 +793,8 @@ tuntap_ip6_add_del_interface_address (ip6_main_t * im,
if (ioctl (sockfd, SIOCSIFADDR, &ifr6) < 0)
clib_unix_warning ("set address");
- close (sockfd);
+ if (sockfd >= 0)
+ close (sockfd);
}
else
{