aboutsummaryrefslogtreecommitdiffstats
path: root/vnet/vnet/ip/ip4_mtrie.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2016-08-04 18:58:05 -0400
committerFlorin Coras <florin.coras@gmail.com>2016-08-05 13:21:59 +0000
commit56faee837281c7f9c28aa40dbf0f6e4620b76be8 (patch)
tree9fc45d3dca2bda5ff6c168fd943a9a6a55d0d2ab /vnet/vnet/ip/ip4_mtrie.c
parent91c7d387fbfdf109f422c56ec5a4a21c9bbd9d02 (diff)
VPP-189 Clean up more coverity warnings
Change-Id: I1b971ab326dc334a4743fd7d4184cef106b0523d Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'vnet/vnet/ip/ip4_mtrie.c')
-rw-r--r--vnet/vnet/ip/ip4_mtrie.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/vnet/vnet/ip/ip4_mtrie.c b/vnet/vnet/ip/ip4_mtrie.c
index 461cd64b86d..0badde769c2 100644
--- a/vnet/vnet/ip/ip4_mtrie.c
+++ b/vnet/vnet/ip/ip4_mtrie.c
@@ -436,10 +436,26 @@ maybe_remap_leaf (ip_lookup_main_t * lm, ip4_fib_mtrie_leaf_t * p)
if (m)
{
was_remapped_to_empty_leaf = m == ~0;
+
+ /*
+ * The intent of the original form - which dates to 2013 or
+ * earlier - is not obvious. Here's the original:
+ *
+ * if (was_remapped_to_empty_leaf)
+ * p[0] = (was_remapped_to_empty_leaf
+ * ? IP4_FIB_MTRIE_LEAF_EMPTY
+ * : ip4_fib_mtrie_leaf_set_adj_index (m - 1));
+ *
+ * Notice the outer "if (was_remapped_to_empty_leaf)"
+ * means that p[0] is always set to IP4_FIB_MTRIE_LEAF_EMPTY,
+ * and is otherwise left intact.
+ *
+ * It seems unlikely that the adjacency mapping scheme
+ * works in detail. Coverity correctly complains that the
+ * else-case of the original ternary expression is dead code.
+ */
if (was_remapped_to_empty_leaf)
- p[0] = (was_remapped_to_empty_leaf
- ? IP4_FIB_MTRIE_LEAF_EMPTY
- : ip4_fib_mtrie_leaf_set_adj_index (m - 1));
+ p[0] = IP4_FIB_MTRIE_LEAF_EMPTY;
}
}
return was_remapped_to_empty_leaf;