diff options
author | Dave Barach <dave@barachs.net> | 2016-08-05 10:10:18 -0400 |
---|---|---|
committer | Dave Barach <dave@barachs.net> | 2016-08-05 10:10:38 -0400 |
commit | f9c231ec12c2233557bfbb58feb87a1fcddf224a (patch) | |
tree | 6ee8846be9a6c79d68d0364c00cc58b2f3547ddd /vnet/vnet/sr | |
parent | 56faee837281c7f9c28aa40dbf0f6e4620b76be8 (diff) |
vpp-189 Clean up more coverity warnings
Time to make the donuts
Change-Id: I528937800f7daefce19723dda0216e58d857942c
Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet/vnet/sr')
-rw-r--r-- | vnet/vnet/sr/sr.c | 11 | ||||
-rw-r--r-- | vnet/vnet/sr/sr_replicate.c | 8 |
2 files changed, 11 insertions, 8 deletions
diff --git a/vnet/vnet/sr/sr.c b/vnet/vnet/sr/sr.c index 05d8d8166da..d935b458ec9 100644 --- a/vnet/vnet/sr/sr.c +++ b/vnet/vnet/sr/sr.c @@ -724,8 +724,10 @@ find_or_add_shared_secret (ip6_sr_main_t * sm, u8 * secret, u32 * indexp) for (i = 0; i < vec_len (sm->hmac_keys); i++) { if (sm->hmac_keys[i].shared_secret == 0) - key = sm->hmac_keys + i; - goto found; + { + key = sm->hmac_keys + i; + goto found; + } } vec_validate (sm->hmac_keys, i); key = sm->hmac_keys + i; @@ -970,7 +972,6 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a) memset(&adj, 0, sizeof (adj)); /* Create an adjacency and add to v6 fib */ - adj.lookup_next_index = IP_LOOKUP_NEXT_REWRITE; adj.lookup_next_index = sm->ip6_lookup_sr_next_index; adj.explicit_fib_index = ~0; @@ -1020,7 +1021,9 @@ int ip6_sr_add_del_tunnel (ip6_sr_add_del_tunnel_args_t * a) p=hash_get_mem (sm->policy_index_by_policy_name, a->policy_name); } vec_add1 (pt->tunnel_indices, t - sm->tunnels); - t->policy_index = p[0]; /* equiv. to (pt - sm->policies) */ + if (p == 0) + clib_warning ("p is NULL!"); + t->policy_index = p ? p[0] : ~0; /* equiv. to (pt - sm->policies) */ } if (a->name) diff --git a/vnet/vnet/sr/sr_replicate.c b/vnet/vnet/sr/sr_replicate.c index ccc01465f73..f059ce95fb3 100644 --- a/vnet/vnet/sr/sr_replicate.c +++ b/vnet/vnet/sr/sr_replicate.c @@ -304,17 +304,17 @@ sr_replicate_node_fn (vlib_main_t * vm, sr_replicate_trace_t *tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); tr->tunnel_index = t0 - sm->tunnels; + tr->length = 0; if (hdr_ip0) { memcpy (tr->src.as_u8, hdr_ip0->src_address.as_u8, sizeof (tr->src.as_u8)); memcpy (tr->dst.as_u8, hdr_ip0->dst_address.as_u8, sizeof (tr->dst.as_u8)); + if (hdr_ip0->payload_length) + tr->length = clib_net_to_host_u16 + (hdr_ip0->payload_length); } - if (hdr_ip0->payload_length) - tr->length = clib_net_to_host_u16(hdr_ip0->payload_length); - else - tr->length = 0; tr->next_index = next_index; memcpy (tr->sr, hdr_sr0, sizeof (tr->sr)); } |