aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2017-04-11 09:13:39 -0700
committerFlorin Coras <florin.coras@gmail.com>2017-04-11 20:35:05 +0000
commitf060930e7f71bde107dc8f07c8693e2b3df99c46 (patch)
treedf5ce2c6381c31f411bf3b6182212ca19a7839bc /src/vnet/ip
parent107e7d4b5375295e94e01653e3cf064ea6647064 (diff)
MTRIE coverity fixes
Change-Id: If98355bebe823f45b11b0908a8d7700ab273a6db Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip4_mtrie.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/vnet/ip/ip4_mtrie.c b/src/vnet/ip/ip4_mtrie.c
index adc95125ed3..e1987d56782 100644
--- a/src/vnet/ip/ip4_mtrie.c
+++ b/src/vnet/ip/ip4_mtrie.c
@@ -271,7 +271,7 @@ set_leaf (ip4_fib_mtrie_t * m,
old_ply = pool_elt_at_index (ip4_ply_pool, old_ply_index);
- ASSERT (a->dst_address_length >= 0 && a->dst_address_length <= 32);
+ ASSERT (a->dst_address_length <= 32);
ASSERT (dst_address_byte_index < ARRAY_LEN (a->dst_address.as_u8));
/* how many bits of the destination address are in the next PLY */
@@ -284,7 +284,8 @@ set_leaf (ip4_fib_mtrie_t * m,
if (n_dst_bits_next_plies <= 0)
{
/* The mask length of the address to insert maps to this ply */
- uword i, n_dst_bits_this_ply, old_leaf_is_terminal;
+ uword i, old_leaf_is_terminal;
+ u32 n_dst_bits_this_ply;
/* The number of bits, and hence slots/buckets, we will fill */
n_dst_bits_this_ply = clib_min (8, -n_dst_bits_next_plies);
@@ -401,7 +402,7 @@ set_root_leaf (ip4_fib_mtrie_t * m,
old_ply = &m->root_ply;
- ASSERT (a->dst_address_length >= 0 && a->dst_address_length <= 32);
+ ASSERT (a->dst_address_length <= 32);
/* how many bits of the destination address are in the next PLY */
n_dst_bits_next_plies = a->dst_address_length - BITS (u16);
@@ -412,7 +413,8 @@ set_root_leaf (ip4_fib_mtrie_t * m,
if (n_dst_bits_next_plies <= 0)
{
/* The mask length of the address to insert maps to this ply */
- uword i, n_dst_bits_this_ply, old_leaf_is_terminal;
+ uword i, old_leaf_is_terminal;
+ u32 n_dst_bits_this_ply;
/* The number of bits, and hence slots/buckets, we will fill */
n_dst_bits_this_ply = 16 - a->dst_address_length;
@@ -515,7 +517,7 @@ unset_leaf (ip4_fib_mtrie_t * m,
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);
+ ASSERT (a->dst_address_length <= 32);
ASSERT (dst_address_byte_index < ARRAY_LEN (a->dst_address.as_u8));
n_dst_bits_next_plies =
@@ -588,7 +590,7 @@ unset_root_leaf (ip4_fib_mtrie_t * m,
u16 dst_byte;
ip4_fib_mtrie_16_ply_t *old_ply;
- ASSERT (a->dst_address_length >= 0 && a->dst_address_length <= 32);
+ ASSERT (a->dst_address_length <= 32);
old_ply = &m->root_ply;
n_dst_bits_next_plies = a->dst_address_length - BITS (u16);