* [PATCH] wil6210: avoid gcc-10 zero-length-bounds warning
@ 2020-05-05 14:33 Arnd Bergmann
2020-05-05 15:44 ` Kalle Valo
2020-05-11 12:33 ` Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2020-05-05 14:33 UTC (permalink / raw)
To: Maya Erez, Kalle Valo, David S. Miller
Cc: Arnd Bergmann, Dedy Lansky, Ahmad Masri, Alexei Avshalom Lazar,
Tzahi Sabo, Gustavo A. R. Silva, Lior David, linux-wireless,
wil6210, netdev, linux-kernel
gcc-10 warns about accesses inside of a zero-length array:
drivers/net/wireless/ath/wil6210/cfg80211.c: In function 'wil_cfg80211_scan':
drivers/net/wireless/ath/wil6210/cfg80211.c:970:23: error: array subscript 255 is outside the bounds of an interior zero-length array 'struct <anonymous>[0]' [-Werror=zero-length-bounds]
970 | cmd.cmd.channel_list[cmd.cmd.num_channels++].channel = ch - 1;
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/wireless/ath/wil6210/wil6210.h:17,
from drivers/net/wireless/ath/wil6210/cfg80211.c:11:
drivers/net/wireless/ath/wil6210/wmi.h:477:4: note: while referencing 'channel_list'
477 | } channel_list[0];
| ^~~~~~~~~~~~
Turn this into a flexible array to avoid the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
Gustavo has a patch to do it for all arrays in this file, and that
should get merged as well, but this simpler patch is sufficient
to shut up the warning.
---
drivers/net/wireless/ath/wil6210/wmi.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/wil6210/wmi.h b/drivers/net/wireless/ath/wil6210/wmi.h
index e3558136e0c4..5bba45c1de48 100644
--- a/drivers/net/wireless/ath/wil6210/wmi.h
+++ b/drivers/net/wireless/ath/wil6210/wmi.h
@@ -474,7 +474,7 @@ struct wmi_start_scan_cmd {
struct {
u8 channel;
u8 reserved;
- } channel_list[0];
+ } channel_list[];
} __packed;
#define WMI_MAX_PNO_SSID_NUM (16)
--
2.26.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] wil6210: avoid gcc-10 zero-length-bounds warning
2020-05-05 14:33 [PATCH] wil6210: avoid gcc-10 zero-length-bounds warning Arnd Bergmann
@ 2020-05-05 15:44 ` Kalle Valo
2020-05-11 12:33 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2020-05-05 15:44 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Maya Erez, David S. Miller, Dedy Lansky, Ahmad Masri,
Alexei Avshalom Lazar, Tzahi Sabo, Gustavo A. R. Silva,
Lior David, linux-wireless, wil6210, netdev, linux-kernel
Arnd Bergmann <arnd@arndb.de> writes:
> gcc-10 warns about accesses inside of a zero-length array:
>
> drivers/net/wireless/ath/wil6210/cfg80211.c: In function 'wil_cfg80211_scan':
> drivers/net/wireless/ath/wil6210/cfg80211.c:970:23: error: array
> subscript 255 is outside the bounds of an interior zero-length array
> 'struct <anonymous>[0]' [-Werror=zero-length-bounds]
> 970 | cmd.cmd.channel_list[cmd.cmd.num_channels++].channel = ch - 1;
> | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
> In file included from drivers/net/wireless/ath/wil6210/wil6210.h:17,
> from drivers/net/wireless/ath/wil6210/cfg80211.c:11:
> drivers/net/wireless/ath/wil6210/wmi.h:477:4: note: while referencing 'channel_list'
> 477 | } channel_list[0];
> | ^~~~~~~~~~~~
>
> Turn this into a flexible array to avoid the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> Gustavo has a patch to do it for all arrays in this file, and that
> should get merged as well, but this simpler patch is sufficient
> to shut up the warning.
I don't see Gustavo's patch yet so I'll take this one first.
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wil6210: avoid gcc-10 zero-length-bounds warning
2020-05-05 14:33 [PATCH] wil6210: avoid gcc-10 zero-length-bounds warning Arnd Bergmann
2020-05-05 15:44 ` Kalle Valo
@ 2020-05-11 12:33 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2020-05-11 12:33 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Maya Erez, David S. Miller, Arnd Bergmann, Dedy Lansky,
Ahmad Masri, Alexei Avshalom Lazar, Tzahi Sabo,
Gustavo A. R. Silva, Lior David, linux-wireless, wil6210, netdev,
linux-kernel
Arnd Bergmann <arnd@arndb.de> wrote:
> gcc-10 warns about accesses inside of a zero-length array:
>
> drivers/net/wireless/ath/wil6210/cfg80211.c: In function 'wil_cfg80211_scan':
> drivers/net/wireless/ath/wil6210/cfg80211.c:970:23: error: array subscript 255 is outside the bounds of an interior zero-length array 'struct <anonymous>[0]' [-Werror=zero-length-bounds]
> 970 | cmd.cmd.channel_list[cmd.cmd.num_channels++].channel = ch - 1;
> | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
> In file included from drivers/net/wireless/ath/wil6210/wil6210.h:17,
> from drivers/net/wireless/ath/wil6210/cfg80211.c:11:
> drivers/net/wireless/ath/wil6210/wmi.h:477:4: note: while referencing 'channel_list'
> 477 | } channel_list[0];
> | ^~~~~~~~~~~~
>
> Turn this into a flexible array to avoid the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
04a4d3416372 wil6210: avoid gcc-10 zero-length-bounds warning
--
https://patchwork.kernel.org/patch/11529309/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-11 12:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 14:33 [PATCH] wil6210: avoid gcc-10 zero-length-bounds warning Arnd Bergmann
2020-05-05 15:44 ` Kalle Valo
2020-05-11 12:33 ` Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.