Subject: [PATCH v2 0/6][next] ath6kl: wmi: Replace one-element arrays with flexible-array members

From: "Gustavo A. R. Silva" <[email-masked]>
Date: Thu, 24 Feb 2022 15:15:31 -0600

This series aims to replace one-element arrays with flexible-array
members in multiple structures in drivers/net/wireless/ath/ath6kl/wmi.h

There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].

This helps with the ongoing efforts to globally enable -Warray-bounds
and get us closer to being able to tighten the FORTIFY_SOURCE routines
on memcpy().

These issues were found with the help of Coccinelle and audited and fixed,
manually.

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays

Link: https://github.com/KSPP/linux/issues/79

Changes in v2:
 - Revert changes in if-statement logic for all the affected patches:
	if (len < sizeof(struct foo))
   Link: https://lore.kernel.org/linux-hardening/[email-masked]/ 
 - Update changelog texts.
 - Add Reviewed-by: Jeff Johnson <[email-masked]> tag.

Gustavo A. R. Silva (6):
  ath6kl: wmi: Replace one-element array with flexible-array member in
    struct wmi_begin_scan_cmd
  ath6kl: wmi: Replace one-element array with flexible-array member in
    struct wmi_start_scan_cmd
  ath6kl: wmi: Replace one-element array with flexible-array member in
    struct wmi_channel_list_reply
  ath6kl: wmi: Replace one-element array with flexible-array member in
    struct wmi_connect_event
  ath6kl: wmi: Replace one-element array with flexible-array member in
    struct wmi_disconnect_event
  ath6kl: wmi: Replace one-element array with flexible-array member in
    struct wmi_aplist_event

 drivers/net/wireless/ath/ath6kl/wmi.c | 22 ++++------------------
 drivers/net/wireless/ath/ath6kl/wmi.h | 12 ++++++------
 2 files changed, 10 insertions(+), 24 deletions(-)

-- 
2.27.0