Fix coverity warnings, VPP-486 85/3385/1
authorDave Barach <dave@barachs.net>
Wed, 12 Oct 2016 21:32:39 +0000 (17:32 -0400)
committerDave Barach <dave@barachs.net>
Wed, 12 Oct 2016 21:32:56 +0000 (17:32 -0400)
Change-Id: I7a14d9a28514cdb49f65fab1b120b53239fed7e3
Signed-off-by: Dave Barach <dave@barachs.net>
vnet/vnet/classify/flow_classify_node.c
vnet/vnet/ip/ip6_neighbor.c
vpp/app/vpe_cli.c
vpp/vpp-api/api.c

index aa3bce5..5c9e082 100644 (file)
@@ -267,7 +267,7 @@ flow_classify_inline (vlib_main_t * vm,
               t->sw_if_index = vnet_buffer(b0)->sw_if_index[VLIB_RX];
               t->next_index = next0;
               t->table_index = t0 ? t0 - vcm->tables : ~0;
-              t->offset = e0 ? vnet_classify_get_offset (t0, e0): ~0;
+              t->offset = (t0 && e0) ? vnet_classify_get_offset (t0, e0): ~0;
             }
 
           /* Verify speculative enqueue, maybe switch current next frame */
index fdec2d4..97e7e84 100644 (file)
@@ -1705,7 +1705,7 @@ ip6_neighbor_sw_interface_add_del (vnet_main_t * vnm,
         a->seed = random_default_seed();
         
         /* for generating random interface ids */
-        a->randomizer = 0x1119194911191949;
+        a->randomizer = 0x1119194911191949ULL;
         a->randomizer = random_u64 ((u32 *)&a->randomizer);
         
         a->initial_adverts_count = MAX_INITIAL_RTR_ADVERTISEMENTS ; 
index 3b24c26..38bf843 100644 (file)
@@ -72,8 +72,7 @@ virtual_ip_cmd_fn_command_fn (vlib_main_t * vm,
                                    format_unformat_error, input);
        }
     }
-  if (vec_len (mac_addrs) == 0 ||
-      vec_len (next_hops) == 0 || vec_len (mac_addrs) != vec_len (next_hops))
+  if (vec_len (mac_addrs) == 0 || vec_len (mac_addrs) != vec_len (next_hops))
     goto barf;
 
   /* Create / delete special interface route /32's */
index 84e4d5d..3840b82 100644 (file)
@@ -1597,6 +1597,14 @@ static void
 
   /* Detect the set of worker threads */
   uword *p = hash_get_mem (tm->thread_registrations_by_name, "workers");
+
+  if (p == 0)
+    {
+      clib_warning ("worker thread registration AWOL !!");
+      rv = VNET_API_ERROR_INVALID_VALUE_2;
+      goto done;
+    }
+
   vlib_thread_registration_t *tr = (vlib_thread_registration_t *) p[0];
   int worker_thread_first = tr->first_index;
   int worker_thread_count = tr->count;