From ad1bc84e6e4faad747aaf6b8499f0f467c242fc6 Mon Sep 17 00:00:00 2001 From: Tianyu Li Date: Thu, 29 Jul 2021 13:39:24 +0800 Subject: l2: fix array-bounds error for prefetch on Arm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit make build-release CC=gcc-10 vpp/src/vppinfra/cache.h:73:31: error: array subscript 80 is outside array bounds of ‘l2_in_out_feat_arc_main_t[1]’ [-Werror=array-bounds] __builtin_prefetch (_addr + (n) *CLIB_CACHE_PREFETCH_BYTES, _CLIB_PREFETCH (3, size, type); vpp/src/vnet/l2/l2_in_out_feat_arc.c:260:3: note: in expansion of macro ‘CLIB_PREFETCH’ CLIB_PREFETCH (next_node_indices, 2 * CLIB_CACHE_LINE_BYTES, LOAD); 2 * CLIB_CACHE_LINE_BYTES is 256 bytes on Arm, the offset is out of range of fam->feat_next_node_index[1], which is 128 bytes, use sizeof array instead. Type: fix Signed-off-by: Tianyu Li Change-Id: Ib7e06fcb643b2e863985ba89efcc274076752133 --- src/vnet/l2/l2_in_out_feat_arc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vnet/l2/l2_in_out_feat_arc.c b/src/vnet/l2/l2_in_out_feat_arc.c index b3b4a8cbb73..94c4c1bb713 100644 --- a/src/vnet/l2/l2_in_out_feat_arc.c +++ b/src/vnet/l2/l2_in_out_feat_arc.c @@ -257,7 +257,8 @@ l2_in_out_feat_arc_node_fn (vlib_main_t * vm, sw_if_index = sw_if_indices; n_left = frame->n_vectors; - CLIB_PREFETCH (next_node_indices, 2 * CLIB_CACHE_LINE_BYTES, LOAD); + CLIB_PREFETCH (next_node_indices, + sizeof (fam->feat_next_node_index[is_output]), LOAD); while (n_left > 3 * L2_FEAT_ARC_VEC_SIZE) { -- cgit 1.2.3-korg