From 8bea589cfe0fca1a6f560e16ca66a4cf199041a2 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Mon, 4 Apr 2022 22:40:45 +0200 Subject: 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 --- src/plugins/memif/device.c | 4 ++-- src/plugins/memif/memif.c | 2 -- src/plugins/memif/memif_api.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/plugins/memif') diff --git a/src/plugins/memif/device.c b/src/plugins/memif/device.c index 94789223ea7..f049a7be38e 100644 --- a/src/plugins/memif/device.c +++ b/src/plugins/memif/device.c @@ -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; diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c index b89665f9a29..f4543c837db 100644 --- a/src/plugins/memif/memif.c +++ b/src/plugins/memif/memif.c @@ -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); diff --git a/src/plugins/memif/memif_api.c b/src/plugins/memif/memif_api.c index a50e7ce8882..593306a1ec7 100644 --- a/src/plugins/memif/memif_api.c +++ b/src/plugins/memif/memif_api.c @@ -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* */ -- cgit 1.2.3-korg