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>
This commit is contained in:
Damjan Marion
2022-04-04 22:40:45 +02:00
committed by Damjan Marion
parent a2b358b1fa
commit 8bea589cfe
119 changed files with 300 additions and 299 deletions

View File

@ -194,8 +194,8 @@ retry:
else
{
/* we need to rollback vectors before bailing out */
_vec_len (ptd->buffers) = saved_ptd_buffers_len;
_vec_len (ptd->copy_ops) = saved_ptd_copy_ops_len;
vec_set_len (ptd->buffers, saved_ptd_buffers_len);
vec_set_len (ptd->copy_ops, saved_ptd_copy_ops_len);
vlib_error_count (vm, node->node_index,
MEMIF_TX_ERROR_ROLLBACK, 1);
slot = saved_slot;

View File

@ -991,8 +991,6 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args)
bt->total_length_not_including_first_buffer = 0;
vnet_buffer (bt)->sw_if_index[VLIB_TX] = (u32) ~ 0;
/* initially prealloc copy_ops so we can use
_vec_len instead of vec_elen */
vec_validate_aligned (ptd->copy_ops, 0, CLIB_CACHE_LINE_BYTES);
vec_reset_length (ptd->copy_ops);
vec_validate_aligned (ptd->buffers, 0, CLIB_CACHE_LINE_BYTES);

View File

@ -289,7 +289,7 @@ vl_api_memif_dump_t_handler (vl_api_memif_dump_t * mp)
vnm, swif, 0);
send_memif_details (reg, mif, swif, if_name, mp->context);
_vec_len (if_name) = 0;
vec_set_len (if_name, 0);
}
/* *INDENT-ON* */