Commit d2eb318f authored by Jeff Johnson's avatar Jeff Johnson Committed by Kalle Valo

wifi: ath10k: use flexible array in struct wmi_host_mem_chunks

Currently struct wmi_host_mem_chunks defines:
	struct host_memory_chunk items[1];

Per the guidance in [1] this should be a flexible array. However there
is a documented requirement:
	some fw revisions require at least 1 chunk regardless of count

To satisfy this requirement, follow the guidance from [2] and wrap the
array in a union which contains both the flexible array and a single
instance of the underlying struct. Since the footprint of the struct
is unchanged, no additional driver changes are required.

No functional changes, compile tested only.

[1] https://docs.kernel.org/process/deprecated.html#zero-length-and-one-element-arrays
[2] https://lore.kernel.org/linux-wireless/202308301529.AC90A9EF98@keescook/Signed-off-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20231213-wmi_host_mem_chunks_flexarray-v1-1-92922d92fa2c@quicinc.com
parent d6b27eb9
...@@ -3069,7 +3069,10 @@ struct host_memory_chunk { ...@@ -3069,7 +3069,10 @@ struct host_memory_chunk {
struct wmi_host_mem_chunks { struct wmi_host_mem_chunks {
__le32 count; __le32 count;
/* some fw revisions require at least 1 chunk regardless of count */ /* some fw revisions require at least 1 chunk regardless of count */
struct host_memory_chunk items[1]; union {
struct host_memory_chunk item;
DECLARE_FLEX_ARRAY(struct host_memory_chunk, items);
};
} __packed; } __packed;
struct wmi_init_cmd { struct wmi_init_cmd {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment