[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f5a23931-6c05-4eed-91a5-5b829ad3aa94@embeddedor.com>
Date: Wed, 13 Dec 2023 14:14:53 -0600
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Jeff Johnson <quic_jjohnson@...cinc.com>,
Kalle Valo <kvalo@...nel.org>
Cc: Kees Cook <keescook@...omium.org>, ath10k@...ts.infradead.org,
linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/6] wifi: ath10k: use flexible array in struct
wmi_host_mem_chunks
On 12/13/23 11:06, Jeff Johnson wrote:
> 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: Jeff Johnson <quic_jjohnson@...cinc.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>
Thanks!
--
Gustavo
> ---
> drivers/net/wireless/ath/ath10k/wmi.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
> index 9146df98fcee..833ce0251a2c 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.h
> +++ b/drivers/net/wireless/ath/ath10k/wmi.h
> @@ -3069,7 +3069,10 @@ struct host_memory_chunk {
> struct wmi_host_mem_chunks {
> __le32 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;
>
> struct wmi_init_cmd {
>
Powered by blists - more mailing lists