aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm
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/svm
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/svm')
-rw-r--r--src/svm/svmdb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/svm/svmdb.c b/src/svm/svmdb.c
index 2c3d351f0c7..7628c0ae809 100644
--- a/src/svm/svmdb.c
+++ b/src/svm/svmdb.c
@@ -281,7 +281,7 @@ local_unset_variable_nolock (svmdb_client_t * client,
if (vec_len (oldvalue->notifications))
notify_value (oldvalue, SVMDB_ACTION_UNSET);
/* zero length value means unset */
- _vec_len (oldvalue->value) = 0;
+ vec_set_len (oldvalue->value, 0);
}
client->shm->namespaces[namespace] = h;
}
@@ -317,7 +317,7 @@ local_set_variable_nolock (svmdb_client_t * client,
oldvalue = pool_elt_at_index (client->shm->values, hp->value[0]);
vec_alloc (oldvalue->value, vec_len (val) * elsize);
clib_memcpy (oldvalue->value, val, vec_len (val) * elsize);
- _vec_len (oldvalue->value) = vec_len (val);
+ vec_set_len (oldvalue->value, vec_len (val));
notify_value (oldvalue, SVMDB_ACTION_SET);
}
else
@@ -328,7 +328,7 @@ local_set_variable_nolock (svmdb_client_t * client,
newvalue->elsize = elsize;
vec_alloc (newvalue->value, vec_len (val) * elsize);
clib_memcpy (newvalue->value, val, vec_len (val) * elsize);
- _vec_len (newvalue->value) = vec_len (val);
+ vec_set_len (newvalue->value, vec_len (val));
name = format (0, "%s%c", var, 0);
hash_set_mem (h, name, newvalue - shm->values);
}
@@ -589,7 +589,7 @@ svmdb_local_get_vec_variable (svmdb_client_t * client, char *var, u32 elsize)
/* Make a copy in process-local memory */
vec_alloc (copy, vec_len (rv) * elsize);
clib_memcpy (copy, rv, vec_len (rv) * elsize);
- _vec_len (copy) = vec_len (rv);
+ vec_set_len (copy, vec_len (rv));
region_unlock (client->db_rp);
return (copy);
}
@@ -653,7 +653,7 @@ svmdb_local_find_or_add_vec_variable (svmdb_client_t * client,
clib_memset (newvalue, 0, sizeof (*newvalue));
newvalue->elsize = 1;
vec_alloc (newvalue->value, nbytes);
- _vec_len (newvalue->value) = nbytes;
+ vec_set_len (newvalue->value, nbytes);
name = format (0, "%s%c", var, 0);
hash_set_mem (h, name, newvalue - shm->values);
shm->namespaces[SVMDB_NAMESPACE_VEC] = h;