* [PATCH net-next] eth: tg3: silence the GCC 12 array-bounds warning
@ 2022-05-20 6:45 Jakub Kicinski
0 siblings, 0 replies; only message in thread
From: Jakub Kicinski @ 2022-05-20 6:45 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, mchan, siva.kallam, prashant, Jakub Kicinski
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>
---
---
drivers/net/ethernet/broadcom/Makefile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/Makefile b/drivers/net/ethernet/broadcom/Makefile
index 0ddfb5b5d53c..577130c020d0 100644
--- a/drivers/net/ethernet/broadcom/Makefile
+++ b/drivers/net/ethernet/broadcom/Makefile
@@ -17,3 +17,8 @@ obj-$(CONFIG_BGMAC_BCMA) += bgmac-bcma.o bgmac-bcma-mdio.o
obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o
obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o
obj-$(CONFIG_BNXT) += bnxt/
+
+# FIXME: temporarily silence -Warray-bounds on non W=1 builds
+ifndef KBUILD_EXTRA_WARN
+CFLAGS_tg3.o += $(call cc-disable-warning, array-bounds)
+endif
--
2.34.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-20 6:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 6:45 [PATCH net-next] eth: tg3: silence the GCC 12 array-bounds warning Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).