]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wifi: carl9170: silence a GCC 12 -Warray-bounds warning
authorJakub Kicinski <kuba@kernel.org>
Fri, 20 May 2022 19:43:20 +0000 (12:43 -0700)
committerJakub Kicinski <kuba@kernel.org>
Mon, 23 May 2022 00:23:15 +0000 (17:23 -0700)
carl9170 has a big union (struct carl9170_cmd) with all the command
types in it. But it allocates buffers only large enough for a given
command. This upsets GCC 12:

drivers/net/wireless/ath/carl9170/cmd.c:125:30: warning: array subscript ‘struct carl9170_cmd[0]’ is partly outside array bounds of ‘unsigned char[8]’ [-Warray-bounds]
  125 |                 tmp->hdr.cmd = cmd;
      |                 ~~~~~~~~~~~~~^~~~~

Punt the warning to W=1 for now. Hopefully GCC will learn to
recognize which fields are in-bounds.

Acked-by: Christian Lamparter <chunkeey@gmail.com>
Acked-by: Kalle Valo <kvalo@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/wireless/ath/carl9170/Makefile

index 1a81868ce26d99012bcbd7858e7c1d2b90975516..7463baa62fa8749f7f9f1bf280b00f2ca6d8f2dd 100644 (file)
@@ -3,3 +3,8 @@ carl9170-objs := main.o usb.o cmd.o mac.o phy.o led.o fw.o tx.o rx.o
 carl9170-$(CONFIG_CARL9170_DEBUGFS) += debug.o
 
 obj-$(CONFIG_CARL9170) += carl9170.o
+
+# FIXME: temporarily silence -Warray-bounds on non W=1+ builds
+ifndef KBUILD_EXTRA_WARN
+CFLAGS_cmd.o += -Wno-array-bounds
+endif