lkml.org 
[lkml]   [2020]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] wil6210: avoid gcc-10 zero-length-bounds warning
Date
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

\
 
 \ /
  Last update: 2020-05-05 17:46    [W:0.037 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site