wifi: brcmfmac: Replace 1-element arrays with flexible arrays
authorJuerg Haefliger <juerg.haefliger@canonical.com>
Thu, 14 Sep 2023 07:02:27 +0000 (09:02 +0200)
committerKalle Valo <kvalo@kernel.org>
Mon, 18 Sep 2023 13:20:21 +0000 (16:20 +0300)
commit4fed494abcd4fde5c24de19160e93814f912fdb3
tree6c6bca1fd1776b8cc65208b57177daff5bf7c317
parentaef7a0300047e7b4707ea0411dc9597cba108fc8
wifi: brcmfmac: Replace 1-element arrays with flexible arrays

Since commit 2d47c6956ab3 ("ubsan: Tighten UBSAN_BOUNDS on GCC"),
UBSAN_BOUNDS no longer pretends 1-element arrays are unbounded. Walking
'element' and 'channel_list' will trigger warnings, so make them proper
flexible arrays.

False positive warnings were:

  UBSAN: array-index-out-of-bounds in drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:6984:20
  index 1 is out of range for type '__le32 [1]'

  UBSAN: array-index-out-of-bounds in drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1126:27
  index 1 is out of range for type '__le16 [1]'

for these lines of code:

  6884  ch.chspec = (u16)le32_to_cpu(list->element[i]);

  1126  params_le->channel_list[i] = cpu_to_le16(chanspec);

Cc: stable@vger.kernel.org # 6.5+
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230914070227.12028-1-juerg.haefliger@canonical.com
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h