Re: [PATCH 02/15] iwlwifi: mvm: fix gcc-10 zero-length-bounds warning

From: Luciano Coelho
Date: Wed Jun 10 2020 - 08:19:03 EST


On Thu, 2020-04-30 at 23:30 +0200, Arnd Bergmann wrote:
> gcc-10 complains when a zero-length array is accessed:
>
> drivers/net/wireless/intel/iwlwifi/mvm/tx.c: In function 'iwl_mvm_rx_ba_notif':
> drivers/net/wireless/intel/iwlwifi/mvm/tx.c:1929:17: warning: array subscript 9 is outside the bounds of an interior zero-length array 'struct iwl_mvm_compressed_ba_tfd[0]' [-Wzero-length-bounds]
> 1929 | &ba_res->tfd[i];
> | ~~~~~~~~~~~^~~
> In file included from drivers/net/wireless/intel/iwlwifi/mvm/../fw/api/tdls.h:68,
> from drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h:68,
> from drivers/net/wireless/intel/iwlwifi/mvm/sta.h:73,
> from drivers/net/wireless/intel/iwlwifi/mvm/mvm.h:83,
> from drivers/net/wireless/intel/iwlwifi/mvm/tx.c:72:
> drivers/net/wireless/intel/iwlwifi/mvm/../fw/api/tx.h:769:35: note: while referencing 'tfd'
> 769 | struct iwl_mvm_compressed_ba_tfd tfd[0];
> | ^~~
>
> Change this structure to use a flexible-array member for 'tfd' instead,
> along with the various structures using an zero-length ieee80211_hdr
> array that do not show warnings today but might be affected by similar
> issues in the future.
>
> Fixes: 6f68cc367ab6 ("iwlwifi: api: annotate compressed BA notif array sizes")
> Fixes: c46e7724bfe9 ("iwlwifi: mvm: support new BA notification response")
> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

Patch applied to iwlwifi-next.git, thanks.

9cec1d547cb7 iwlwifi: mvm: fix gcc-10 zero-length-bounds warning