eth: silence the GCC 12 array-bounds warnings
Subsystems (4)
Jakub Kicinski
maintainerv2 cover eth: silence the GCC 12 array-bounds warnings
Silence the array-bounds warnings in Ethernet drivers. v2 uses -Wno-array-bounds directly.
Jakub Kicinski (3):
eth: mtk_eth_soc: silence the GCC 12 array-bounds warning
eth: ice: silence the GCC 12 array-bounds warning
eth: tg3: silence the GCC 12 array-bounds warning
drivers/net/ethernet/broadcom/Makefile | 5 +++++ drivers/net/ethernet/intel/ice/Makefile | 5 +++++ drivers/net/ethernet/mediatek/Makefile | 5 +++++ 3 files changed, 15 insertions(+)
Signature · 1 line
2.34.3
Jakub Kicinski
maintainerPATCH v2 3/3 eth: tg3: silence the GCC 12 array-bounds warning
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.
---
--- drivers/net/ethernet/broadcom/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/broadcom/Makefile +5 -0
@@ -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 += -Wno-array-bounds +endif
Signature · 1 line
2.34.3
Jakub Kicinski
maintainerPATCH v2 2/3 eth: ice: silence the GCC 12 array-bounds warning
In reply to Jakub KicinskiGCC 12 gets upset because driver allocates partial struct ice_aqc_sw_rules_elem buffers. The writes are within bounds.
Silence these warnings for now, our build bot runs GCC 12 so we won't allow any new instances.
---
CC: [email protected]
CC: [email protected]
--- drivers/net/ethernet/intel/ice/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/intel/ice/Makefile +5 -0
@@ -47,3 +47,8 @@ ice-$(CONFIG_DCB) += ice_dcb.o ice_dcb_nl.o ice_dcb_lib.o ice-$(CONFIG_RFS_ACCEL) += ice_arfs.o ice-$(CONFIG_XDP_SOCKETS) += ice_xsk.o ice-$(CONFIG_ICE_SWITCHDEV) += ice_eswitch.o + +# FIXME: temporarily silence -Warray-bounds on non W=1+ builds +ifndef KBUILD_EXTRA_WARN +CFLAGS_ice_switch.o += -Wno-array-bounds +endif
Signature · 1 line
2.34.3
Jakub Kicinski
maintainerPATCH v2 1/3 eth: mtk_eth_soc: silence the GCC 12 array-bounds warning
In reply to Jakub KicinskiGCC 12 gets upset because in mtk_foe_entry_commit_subflow() this driver allocates a partial structure. The writes are within bounds.
Silence these warnings for now, our build bot runs GCC 12 so we won't allow any new instances.
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
--- drivers/net/ethernet/mediatek/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/mediatek/Makefile +5 -0
@@ -11,3 +11,8 @@ mtk_eth-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_debugfs.o endif obj-$(CONFIG_NET_MEDIATEK_SOC_WED) += mtk_wed_ops.o obj-$(CONFIG_NET_MEDIATEK_STAR_EMAC) += mtk_star_emac.o + +# FIXME: temporarily silence -Warray-bounds on non W=1+ builds +ifndef KBUILD_EXTRA_WARN +CFLAGS_mtk_ppe.o += -Wno-array-bounds +endif
Signature · 1 line
2.34.3
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 9 lines · On Fri, 20 May 2022 12:56:02 -0700 you wrote:
Silence the array-bounds warnings in Ethernet drivers. v2 uses -Wno-array-bounds directly.
Jakub Kicinski (3):
eth:mtk_eth_soc: silence the GCC 12 array-bounds warning
eth: ice: silence the GCC 12 array-bounds warning
eth: tg3: silence the GCC 12 array-bounds warning[...]
Here is the summary with links:
- [net-next,v2,1/3] eth: mtk_eth_soc: silence the GCC 12 array-bounds warning
https://git.kernel.org/netdev/net-next/c/06da3e8f390a - [net-next,v2,2/3] eth: ice: silence the GCC 12 array-bounds warning https://git.kernel.org/netdev/net-next/c/385bc51b41ea - [net-next,v2,3/3] eth: tg3: silence the GCC 12 array-bounds warning https://git.kernel.org/netdev/net-next/c/9dec850fd7c2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html