misc: coverity fixes 94/31294/3
authorDave Barach <dave@barachs.net>
Mon, 15 Feb 2021 17:46:47 +0000 (12:46 -0500)
committerFlorin Coras <florin.coras@gmail.com>
Mon, 15 Feb 2021 19:27:09 +0000 (19:27 +0000)
Type: fix

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I6a3348c7edd1cce6b407d336443103f77392bc5d

src/svm/svmtool.c
src/vnet/classify/classify_api.c
src/vnet/ethernet/node.c

index 61f8372..6085967 100644 (file)
@@ -265,6 +265,7 @@ svm_existing_region_map_nolock (void *root_arg, svm_map_region_args_t * a)
       svm_pop_heap (oldheap);
       return rp;
     }
+  region_unlock (root_rp);
   return 0;
 
 }
index 4b182ca..7c08528 100644 (file)
@@ -101,11 +101,9 @@ static void vl_api_classify_pcap_lookup_table_t_handler
   u32 mask_len = ntohl (mp->mask_len);
   u32 sw_if_index = ntohl (mp->sw_if_index);
 
-  if (n_skip > 5
-      || 0 <= n_match || n_match > 5
-      || mask_len != n_match * sizeof (u32x4)
-      || sw_if_index == ~0
-      || sw_if_index >= vec_len (cm->classify_table_index_by_sw_if_index))
+  if (n_skip > 5 || n_match == 0 || n_match > 5 ||
+      mask_len != n_match * sizeof (u32x4) || sw_if_index == ~0 ||
+      sw_if_index >= vec_len (cm->classify_table_index_by_sw_if_index))
     {
       rv = VNET_API_ERROR_INVALID_VALUE;
       goto out;
index efe7290..f4f84f8 100644 (file)
@@ -1340,7 +1340,7 @@ ethernet_input_inline (vlib_main_t * vm,
                }
              else
                {
-                 if (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
+                 if (ei && (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3))
                    goto skip_dmac_check01;
 
                  dmacs[0] = *(u64 *) e0;
@@ -1584,7 +1584,7 @@ ethernet_input_inline (vlib_main_t * vm,
                }
              else
                {
-                 if (ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
+                 if (ei && ei->flags & ETHERNET_INTERFACE_FLAG_STATUS_L3)
                    goto skip_dmac_check0;
 
                  dmacs[0] = *(u64 *) e0;