diff mbox series

[net-next] eth: ice: silence the GCC 12 array-bounds warning

Message ID 20220520060906.2311308-1-kuba@kernel.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] eth: ice: silence the GCC 12 array-bounds warning | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: intel-wired-lan@lists.osuosl.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jakub Kicinski May 20, 2022, 6:09 a.m. UTC
GCC 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.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: jesse.brandeburg@intel.com
CC: anthony.l.nguyen@intel.com
---
 drivers/net/ethernet/intel/ice/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

Comments

David Laight May 20, 2022, 12:58 p.m. UTC | #1
From: Jakub Kicinski
> Sent: 20 May 2022 07:09
> 
> GCC 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.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: jesse.brandeburg@intel.com
> CC: anthony.l.nguyen@intel.com
> ---
>  drivers/net/ethernet/intel/ice/Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/Makefile b/drivers/net/ethernet/intel/ice/Makefile
> index 9183d480b70b..588b6e8c7920 100644
> --- a/drivers/net/ethernet/intel/ice/Makefile
> +++ b/drivers/net/ethernet/intel/ice/Makefile
> @@ -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 += $(call cc-disable-warning, array-bounds)
> +endif
> --
> 2.34.3

Is it possible to just add:

CFLAGS_ice_switch.o += $(disable-Warray-bounds)

and then ensure that disable-Warray-bounds is defined
(and expanded) by the time it is actually expanded?
This might be before or after the makefile is expanded.
But it would mean that the work is only done once.
I've an idea that 'call cc-disable-warning' is non-trivial.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Jakub Kicinski May 20, 2022, 4:50 p.m. UTC | #2
On Fri, 20 May 2022 12:58:35 +0000 David Laight wrote:
> > +# FIXME: temporarily silence -Warray-bounds on non W=1 builds
> > +ifndef KBUILD_EXTRA_WARN
> > +CFLAGS_ice_switch.o += $(call cc-disable-warning, array-bounds)
> > +endif
> > --
> > 2.34.3  
> 
> Is it possible to just add:
> 
> CFLAGS_ice_switch.o += $(disable-Warray-bounds)
> 
> and then ensure that disable-Warray-bounds is defined
> (and expanded) by the time it is actually expanded?
> This might be before or after the makefile is expanded.
> But it would mean that the work is only done once.
> I've an idea that 'call cc-disable-warning' is non-trivial.

Happy to do whatever's recommended but the $(disable-Warray-bounds)
does not work, I still see the warning.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/Makefile b/drivers/net/ethernet/intel/ice/Makefile
index 9183d480b70b..588b6e8c7920 100644
--- a/drivers/net/ethernet/intel/ice/Makefile
+++ b/drivers/net/ethernet/intel/ice/Makefile
@@ -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 += $(call cc-disable-warning, array-bounds)
+endif