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>
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index 323508b..631bbac 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -293,7 +293,7 @@
n_required + n_free_bufs - 1);
n_free_bufs += vlib_buffer_alloc (
vm, &apm->rx_buffers[thread_index][n_free_bufs], n_required);
- _vec_len (apm->rx_buffers[thread_index]) = n_free_bufs;
+ vec_set_len (apm->rx_buffers[thread_index], n_free_bufs);
}
while (num_pkts && (n_free_bufs >= min_bufs))
@@ -341,7 +341,8 @@
u32 last_empty_buffer =
vec_len (apm->rx_buffers[thread_index]) - 1;
bi0 = apm->rx_buffers[thread_index][last_empty_buffer];
- _vec_len (apm->rx_buffers[thread_index]) = last_empty_buffer;
+ vec_set_len (apm->rx_buffers[thread_index],
+ last_empty_buffer);
n_free_bufs--;
/* copy data */