l2: fix array-bounds error for prefetch on Arm 07/33307/2
authorTianyu Li <tianyu.li@arm.com>
Thu, 29 Jul 2021 05:39:24 +0000 (13:39 +0800)
committerDamjan Marion <dmarion@me.com>
Sun, 7 Nov 2021 04:25:14 +0000 (04:25 +0000)
commitad1bc84e6e4faad747aaf6b8499f0f467c242fc6
tree010b5992dc8e667b972209ded87e353293daedca
parente6189d8d0b8fd44c8b593ad6d3bf34c6a5d44618
l2: fix array-bounds error for prefetch on Arm

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 <tianyu.li@arm.com>
Change-Id: Ib7e06fcb643b2e863985ba89efcc274076752133
src/vnet/l2/l2_in_out_feat_arc.c