diff options
author | Kees Cook <[email protected]> | 2023-01-05 15:22:29 -0800 |
---|---|---|
committer | David S. Miller <[email protected]> | 2023-01-09 07:32:21 +0000 |
commit | 2ab6478d1266b522a0a6ce3697914d63529f9e7a (patch) | |
tree | aa77107b5551199fb7030b9fa07a2020ee43159f /tools/testing/selftests/bpf/progs/test_autoload.c | |
parent | 60ea6f00c57dae5e7ba2c52ed407cb24fdb11ebe (diff) |
mlxsw: spectrum_router: Replace 0-length array with flexible array
Zero-length arrays are deprecated[1]. Replace struct
mlxsw_sp_nexthop_group_info's "nexthops" 0-length array with a flexible
array. Detected with GCC 13, using -fstrict-flex-arrays=3:
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c: In function 'mlxsw_sp_nexthop_group_hash_obj':
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3278:38: warning: array subscript i is outside array bounds of 'struct mlxsw_sp_nexthop[0]' [-Warray-bounds=]
3278 | val ^= jhash(&nh->ifindex, sizeof(nh->ifindex), seed);
| ^~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:2954:33: note: while referencing 'nexthops'
2954 | struct mlxsw_sp_nexthop nexthops[0];
| ^~~~~~~~
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays
Cc: Ido Schimmel <[email protected]>
Cc: Petr Machata <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: "Gustavo A. R. Silva" <[email protected]>
Cc: [email protected]
Signed-off-by: Kees Cook <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Reviewed-by: Gustavo A. R. Silva <[email protected]>
Tested-by: Petr Machata <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_autoload.c')
0 files changed, 0 insertions, 0 deletions