vpp-189 Clean up more coverity warnings
Time to make the donuts
Change-Id: I528937800f7daefce19723dda0216e58d857942c
Signed-off-by: Dave Barach <dave@barachs.net>
diff --git a/vnet/vnet/sr/sr.c b/vnet/vnet/sr/sr.c
index 05d8d81..d935b45 100644
--- a/vnet/vnet/sr/sr.c
+++ b/vnet/vnet/sr/sr.c
@@ -724,8 +724,10 @@
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 @@
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 @@
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)