Search Linux Wireless

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/3abb0846-a26f-3d76-8936-cd23cf4387f1@xxxxxxxxxxx/ 
 - Update changelog texts.
 - Add Reviewed-by: Jeff Johnson <quic_jjohnson@xxxxxxxxxxx> 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




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux