wifi: ath10k: use flexible arrays for WMI start scan TLVs
authorJeff Johnson <quic_jjohnson@quicinc.com>
Sun, 17 Dec 2023 11:29:03 +0000 (13:29 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Mon, 18 Dec 2023 18:47:03 +0000 (20:47 +0200)
commit72ca7c4073ac126be1c2341644838ef5f146b36b
treeb422be558800bf157b32bc63698709d66855f70b
parentd2eb318f4b6be1176e87ac3f9f8cc976be1c014b
wifi: ath10k: use flexible arrays for WMI start scan TLVs

Currently ath10k defines the following struct:
struct wmi_start_scan_tlvs {
u8 tlvs[0];
} __packed;

Per the guidance in [1] this should be a flexible array. However, a
direct replace to u8 tlvs[] results in the compilation error:
       flexible array member in a struct with no named members

This is because C99 6.7.2.1 (16) requires that a structure containing
a flexible array member must have more than one named member.

So rather than defining a separate struct wmi_start_scan_tlvs which
contains the flexible tlvs[] array, just define the tlvs[] array where
struct wmi_start_scan_tlvs is being used.

No functional changes, compile tested only.

[1] https://docs.kernel.org/process/deprecated.html#zero-length-and-one-element-arrays

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20231213-wmi_host_mem_chunks_flexarray-v1-2-92922d92fa2c@quicinc.com
drivers/net/wireless/ath/ath10k/wmi.c
drivers/net/wireless/ath/ath10k/wmi.h