aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/mhash.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-04-04 22:40:45 +0200
committerDamjan Marion <dmarion@me.com>2022-04-04 23:17:13 +0000
commit8bea589cfe0fca1a6f560e16ca66a4cf199041a2 (patch)
treecf2767f8f5f31344468b65e14baa3f1a4c85fb91 /src/vppinfra/mhash.c
parenta2b358b1faf6e762e1d29a931d83c7735ac9a77d (diff)
vppinfra: make _vec_len() read-only
Use of _vec_len() to set vector length breaks address sanitizer. Users should use vec_set_len(), vec_inc_len(), vec_dec_len () instead. Type: improvement Change-Id: I441ae948771eb21c23a61f3ff9163bdad74a2cb8 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/mhash.c')
-rw-r--r--src/vppinfra/mhash.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/vppinfra/mhash.c b/src/vppinfra/mhash.c
index c556312e64f..f0f1aa470d7 100644
--- a/src/vppinfra/mhash.c
+++ b/src/vppinfra/mhash.c
@@ -295,7 +295,7 @@ mhash_set_mem (mhash_t * h, void *key, uword * new_value, uword * old_value)
{
i = h->key_vector_free_indices[l - 1];
k = vec_elt_at_index (h->key_vector_or_heap, i);
- _vec_len (h->key_vector_free_indices) = l - 1;
+ vec_set_len (h->key_vector_free_indices, l - 1);
}
else
{
@@ -332,10 +332,10 @@ mhash_set_mem (mhash_t * h, void *key, uword * new_value, uword * old_value)
if (key_alloc_from_free_list)
{
h->key_vector_free_indices[l] = i;
- _vec_len (h->key_vector_free_indices) = l + 1;
+ vec_set_len (h->key_vector_free_indices, l + 1);
}
else
- _vec_len (h->key_vector_or_heap) -= h->n_key_bytes;
+ vec_dec_len (h->key_vector_or_heap, h->n_key_bytes);
}
}