Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ath6kl: Replace zero-length arrays with flexible-array members

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].

[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/78
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220216194857.GA904059@embeddedor

authored by

Gustavo A. R. Silva and committed by
Kalle Valo
d9bc1416 e9e59168

+13 -13
+13 -13
drivers/net/wireless/ath/ath6kl/wmi.h
··· 1637 1637 1638 1638 struct bss_bias_info { 1639 1639 u8 num_bss; 1640 - struct bss_bias bss_bias[0]; 1640 + struct bss_bias bss_bias[]; 1641 1641 } __packed; 1642 1642 1643 1643 struct low_rssi_scan_params { ··· 1720 1720 1721 1721 struct wmi_neighbor_report_event { 1722 1722 u8 num_neighbors; 1723 - struct wmi_neighbor_info neighbor[0]; 1723 + struct wmi_neighbor_info neighbor[]; 1724 1724 } __packed; 1725 1725 1726 1726 /* TKIP MIC Error Event */ ··· 2051 2051 struct wmi_set_appie_cmd { 2052 2052 u8 mgmt_frm_type; /* enum wmi_mgmt_frame_type */ 2053 2053 u8 ie_len; 2054 - u8 ie_info[0]; 2054 + u8 ie_info[]; 2055 2055 } __packed; 2056 2056 2057 2057 struct wmi_set_ie_cmd { ··· 2059 2059 u8 ie_field; /* enum wmi_ie_field_type */ 2060 2060 u8 ie_len; 2061 2061 u8 reserved; 2062 - u8 ie_info[0]; 2062 + u8 ie_info[]; 2063 2063 } __packed; 2064 2064 2065 2065 /* Notify the WSC registration status to the target */ ··· 2127 2127 u8 filter_list_id; 2128 2128 u8 filter_size; 2129 2129 u8 filter_offset; 2130 - u8 filter[0]; 2130 + u8 filter[]; 2131 2131 } __packed; 2132 2132 2133 2133 struct wmi_del_wow_pattern_cmd { ··· 2360 2360 __le32 freq; 2361 2361 __le32 wait; 2362 2362 __le16 len; 2363 - u8 data[0]; 2363 + u8 data[]; 2364 2364 } __packed; 2365 2365 2366 2366 struct wmi_send_mgmt_cmd { ··· 2369 2369 __le32 wait; 2370 2370 __le32 no_cck; 2371 2371 __le16 len; 2372 - u8 data[0]; 2372 + u8 data[]; 2373 2373 } __packed; 2374 2374 2375 2375 struct wmi_tx_status_event { ··· 2389 2389 u8 role_id; 2390 2390 u8 mgmt_frm_type; 2391 2391 u8 ie_len; 2392 - u8 ie_info[0]; 2392 + u8 ie_info[]; 2393 2393 } __packed; 2394 2394 2395 2395 struct wmi_remain_on_chnl_event { ··· 2406 2406 struct wmi_rx_action_event { 2407 2407 __le32 freq; 2408 2408 __le16 len; 2409 - u8 data[0]; 2409 + u8 data[]; 2410 2410 } __packed; 2411 2411 2412 2412 struct wmi_p2p_capabilities_event { 2413 2413 __le16 len; 2414 - u8 data[0]; 2414 + u8 data[]; 2415 2415 } __packed; 2416 2416 2417 2417 struct wmi_p2p_rx_probe_req_event { 2418 2418 __le32 freq; 2419 2419 __le16 len; 2420 - u8 data[0]; 2420 + u8 data[]; 2421 2421 } __packed; 2422 2422 2423 2423 #define P2P_FLAG_CAPABILITIES_REQ (0x00000001) ··· 2431 2431 struct wmi_p2p_info_event { 2432 2432 __le32 info_req_flags; 2433 2433 __le16 len; 2434 - u8 data[0]; 2434 + u8 data[]; 2435 2435 } __packed; 2436 2436 2437 2437 struct wmi_p2p_capabilities { ··· 2450 2450 __le32 freq; 2451 2451 u8 destination_addr[ETH_ALEN]; 2452 2452 __le16 len; 2453 - u8 data[0]; 2453 + u8 data[]; 2454 2454 } __packed; 2455 2455 2456 2456 /* Extended WMI (WMIX)