net: stmmac: fix out-of-bounds access in a selftest
authorJakub Kicinski <kuba@kernel.org>
Thu, 19 May 2022 00:43:05 +0000 (17:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:23:02 +0000 (10:23 +0200)
commit651c6b2d1dacbddc2fa64738b249e5a42686ebe8
tree6abf66489ac0a182f9ff58f2f95f50a6be683aed
parent41f3571616acfc7b7db07b6ba54b0c4fe7375e27
net: stmmac: fix out-of-bounds access in a selftest

[ Upstream commit fe5c5fc145edcf98a759b895f52b646730eeb7be ]

GCC 12 points out that struct tc_action is smaller than
struct tcf_action:

drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c: In function ‘stmmac_test_rxp’:
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:1132:21: warning: array subscript ‘struct tcf_gact[0]’ is partly outside array bounds of ‘unsigned char[272]’ [-Warray-bounds]
 1132 |                 gact->tcf_action = TC_ACT_SHOT;
      |                     ^~

Fixes: ccfc639a94f2 ("net: stmmac: selftests: Add a selftest for Flexible RX Parser")
Link: https://lore.kernel.org/r/20220519004305.2109708-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c