vppinfra: add vec_set_len()
l2-flood and bier nodes reset vector length without updating it to its
effective size. Introduce a helper to do it (this allows ASAN to keep
track of the new vector size).
Type: refactor
Change-Id: I2d652550c440f0553a2b49c3ee3d37b49ebc16c3
Signed-off-by: Benoît Ganne <bganne@cisco.com>
diff --git a/src/vnet/bier/bier_lookup.c b/src/vnet/bier/bier_lookup.c
index a9fab9c..9361845 100644
--- a/src/vnet/bier/bier_lookup.c
+++ b/src/vnet/bier/bier_lookup.c
@@ -147,10 +147,9 @@
memcpy(bbs.bbs_buckets, bh0->bh_bit_string, bbs.bbs_len);
/*
- * reset the fmask and clone storage vectors
+ * reset the fmask storage vector
*/
vec_reset_length (blm->blm_fmasks[thread_index]);
- vec_reset_length (blm->blm_clones[thread_index]);
/*
* Loop through the buckets in the header
@@ -225,7 +224,9 @@
n_clones,
VLIB_BUFFER_CLONE_HEAD_SIZE);
- if (num_cloned != vec_len(blm->blm_fmasks[thread_index]))
+ vec_set_len(blm->blm_clones[thread_index], num_cloned);
+
+ if (num_cloned != n_clones)
{
vlib_node_increment_counter
(vm, node->node_index,