MFIB: coverity fixes 85/16585/2
authorNeale Ranns <nranns@cisco.com>
Fri, 21 Dec 2018 15:00:56 +0000 (07:00 -0800)
committerFlorin Coras <florin.coras@gmail.com>
Fri, 21 Dec 2018 15:59:08 +0000 (15:59 +0000)
Change-Id: I5c1bc498f7299e175070eb288e40f8d037c9be3a
Signed-off-by: Neale Ranns <nranns@cisco.com>
src/vnet/mfib/ip6_mfib.c
src/vnet/mfib/mfib_entry.c

index d47887b..aa9fdb9 100644 (file)
@@ -438,7 +438,7 @@ ip6_mfib_table_lookup (const ip6_mfib_t *mfib,
     {
        len = table->prefix_lengths_in_search_order[i];
 
-       ASSERT(len >= 0 && len <= 256);
+       ASSERT(len <= 256);
         IP6_MFIB_MK_KEY(mfib, grp, src, len, key);
 
        rv = clib_bihash_search_inline_2_40_8(&table->ip6_mhash, &key, &value);
index ac37665..79d2f9a 100644 (file)
@@ -633,16 +633,25 @@ mfib_entry_stack (mfib_entry_t *mfib_entry,
         {
             /*
              * for exclusive routes the source provided a replicate DPO
-             * we we stashed inthe special path list with one path
+             * which we stashed in the special path list with one path,
              * so we can stack directly on that.
              */
             ASSERT(1 == vec_len(ctx.next_hops));
 
-            dpo_stack(DPO_MFIB_ENTRY, dp,
-                      &mfib_entry->mfe_rep,
-                      &ctx.next_hops[0].path_dpo);
-            dpo_reset(&ctx.next_hops[0].path_dpo);
-            vec_free(ctx.next_hops);
+            if (NULL != ctx.next_hops)
+            {
+                dpo_stack(DPO_MFIB_ENTRY, dp,
+                          &mfib_entry->mfe_rep,
+                          &ctx.next_hops[0].path_dpo);
+                dpo_reset(&ctx.next_hops[0].path_dpo);
+                vec_free(ctx.next_hops);
+            }
+            else
+            {
+                dpo_stack(DPO_MFIB_ENTRY, dp,
+                          &mfib_entry->mfe_rep,
+                          drop_dpo_get(dp));
+            }
         }
     }
     else