diff options
author | Damjan Marion <damarion@cisco.com> | 2022-04-04 22:40:45 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2022-04-04 23:17:13 +0000 |
commit | 8bea589cfe0fca1a6f560e16ca66a4cf199041a2 (patch) | |
tree | cf2767f8f5f31344468b65e14baa3f1a4c85fb91 /src/vnet/devices | |
parent | a2b358b1faf6e762e1d29a931d83c7735ac9a77d (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/vnet/devices')
-rw-r--r-- | src/vnet/devices/af_packet/node.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c index 323508bd304..631bbac1117 100644 --- a/src/vnet/devices/af_packet/node.c +++ b/src/vnet/devices/af_packet/node.c @@ -293,7 +293,7 @@ af_packet_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, 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 @@ af_packet_device_input_fn (vlib_main_t *vm, vlib_node_runtime_t *node, 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 */ |