aboutsummaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-08-12 09:26:47 -0400
committerDave Barach <dave@barachs.net>2016-08-12 09:27:05 -0400
commit042ffb4f818fda559ec2c128f475b1258e657e45 (patch)
treed5125ea24cd0ad0cea46ff9937bc208dea486e23 /vnet
parent6353920e0c2507e2e67ef4033fd1bc92fd8ba965 (diff)
VPP-189 fix more coverity warnings
Change-Id: If464a5f06ab15eead9eaf12e89792d3761796956 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/classify/vnet_classify.c14
-rw-r--r--vnet/vnet/lisp-gpe/ip_forward.c1
-rw-r--r--vnet/vnet/map/map.c6
-rw-r--r--vnet/vnet/policer/xlate.c4
4 files changed, 16 insertions, 9 deletions
diff --git a/vnet/vnet/classify/vnet_classify.c b/vnet/vnet/classify/vnet_classify.c
index 23aa51592c2..3b75ab5dc67 100644
--- a/vnet/vnet/classify/vnet_classify.c
+++ b/vnet/vnet/classify/vnet_classify.c
@@ -980,8 +980,11 @@ uword unformat_classify_mask (unformat_input_t * input, va_list * args)
if (l2 == 0)
vec_validate (l2, 13);
mask = l2;
- vec_append (mask, l3);
- vec_free (l3);
+ if (l3)
+ {
+ vec_append (mask, l3);
+ vec_free (l3);
+ }
}
/* Scan forward looking for the first significant mask octet */
@@ -1715,8 +1718,11 @@ uword unformat_classify_match (unformat_input_t * input, va_list * args)
if (l2 == 0)
vec_validate_aligned (l2, 13, sizeof(u32x4));
match = l2;
- vec_append_aligned (match, l3, sizeof(u32x4));
- vec_free (l3);
+ if (l3)
+ {
+ vec_append_aligned (match, l3, sizeof(u32x4));
+ vec_free (l3);
+ }
}
/* Make sure the vector is big enough even if key is all 0's */
diff --git a/vnet/vnet/lisp-gpe/ip_forward.c b/vnet/vnet/lisp-gpe/ip_forward.c
index 47f3f7b3755..98c52226280 100644
--- a/vnet/vnet/lisp-gpe/ip_forward.c
+++ b/vnet/vnet/lisp-gpe/ip_forward.c
@@ -162,6 +162,7 @@ ip4_sd_fib_clear_src_fib (lisp_gpe_main_t * lgm, ip4_fib_t * fib)
ip4_route_t x;
x.address_length = i;
+ x.index = 0; /* shut up coverity */
hash_foreach_pair (p, hash,
({
diff --git a/vnet/vnet/map/map.c b/vnet/vnet/map/map.c
index 8236811f8b1..93a10c679f0 100644
--- a/vnet/vnet/map/map.c
+++ b/vnet/vnet/map/map.c
@@ -511,10 +511,10 @@ map_add_domain_command_fn (vlib_main_t * vm,
ip4_address_t ip4_prefix;
ip6_address_t ip6_prefix;
ip6_address_t ip6_src;
- u32 ip6_prefix_len, ip4_prefix_len, map_domain_index, ip6_src_len;
+ u32 ip6_prefix_len = 0, ip4_prefix_len = 0, map_domain_index, ip6_src_len;
u32 num_m_args = 0;
/* Optional arguments */
- u32 ea_bits_len, psid_offset = 0, psid_length = 0;
+ u32 ea_bits_len = 0, psid_offset = 0, psid_length = 0;
u32 mtu = 0;
u8 flags = 0;
ip6_src_len = 128;
@@ -607,7 +607,7 @@ map_add_rule_command_fn (vlib_main_t * vm,
unformat_input_t _line_input, *line_input = &_line_input;
ip6_address_t tep;
u32 num_m_args = 0;
- u32 psid, map_domain_index;
+ u32 psid = 0, map_domain_index;
/* Get a line of input. */
if (!unformat_user (input, unformat_line_input, line_input))
diff --git a/vnet/vnet/policer/xlate.c b/vnet/vnet/policer/xlate.c
index 61976b1cbde..c9250eb8d87 100644
--- a/vnet/vnet/policer/xlate.c
+++ b/vnet/vnet/policer/xlate.c
@@ -1238,11 +1238,11 @@ sse2_pol_convert_hw_to_cfg_params (sse2_qos_pol_hw_params_st *hw,
return EINVAL;
}
- temp_rate = ((hw->avg_rate_man << hw->rate_exp) * 8LL *
+ temp_rate = (((uint64_t) hw->avg_rate_man << hw->rate_exp) * 8LL *
SSE2_QOS_POL_TICKS_PER_SEC)/1000;
cfg->rb.kbps.cir_kbps = (uint32_t)temp_rate;
- temp_rate = ((hw->peak_rate_man << hw->rate_exp) * 8LL *
+ temp_rate = (((uint64_t) hw->peak_rate_man << hw->rate_exp) * 8LL *
SSE2_QOS_POL_TICKS_PER_SEC)/1000;
cfg->rb.kbps.eir_kbps = (uint32_t)temp_rate;