mbox series

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

Message ID cover.1645583264.git.gustavoars@kernel.org
Headers show
Series ath6kl: wmi: Replace one-element arrays with flexible-array members | expand

Message

Gustavo A. R. Silva Feb. 23, 2022, 2:38 a.m. UTC
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

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 | 30 +++++++--------------------
 drivers/net/wireless/ath/ath6kl/wmi.h | 12 +++++------
 2 files changed, 14 insertions(+), 28 deletions(-)