]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
eth: tg3: silence the GCC 12 array-bounds warning
authorJakub Kicinski <kuba@kernel.org>
Fri, 20 May 2022 19:56:05 +0000 (12:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 14:53:46 +0000 (16:53 +0200)
commitd5ef9f9b979d86adebca130f5c1dbd9ced3920b8
tree96fd59986860fe466c2b934a8a4d9b5a6aa9d26b
parent93dbcff81aa3930024ad89853af2ef27378c6fad
eth: tg3: silence the GCC 12 array-bounds warning

[ Upstream commit 9dec850fd7c210a04b4707df8e6c95bfafdd6a4b ]

GCC 12 currently generates a rather inconsistent warning:

drivers/net/ethernet/broadcom/tg3.c:17795:51: warning: array subscript 5 is above array bounds of ‘struct tg3_napi[5]’ [-Warray-bounds]
17795 |                 struct tg3_napi *tnapi = &tp->napi[i];
      |                                           ~~~~~~~~^~~

i is guaranteed < tp->irq_max which in turn is either 1 or 5.
There are more loops like this one in the driver, but strangely
GCC 12 dislikes only this single one.

Silence this silliness for now.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/Makefile