public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Jeff Johnson <quic_jjohnson@quicinc.com>, Kalle Valo <kvalo@kernel.org>
Cc: Kees Cook <keescook@chromium.org>,
	ath10k@lists.infradead.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] wifi: ath10k: use flexible array in struct wmi_tdls_peer_capabilities
Date: Wed, 13 Dec 2023 14:19:43 -0600	[thread overview]
Message-ID: <a015d185-ece0-4608-821d-061d1296d4e7@embeddedor.com> (raw)
In-Reply-To: <20231213-wmi_host_mem_chunks_flexarray-v1-5-92922d92fa2c@quicinc.com>



On 12/13/23 11:06, Jeff Johnson wrote:
> Currently struct wmi_tdls_peer_capabilities defines:
> 	struct wmi_channel peer_chan_list[1];
> 
> Per the guidance in [1] this should be a flexible array, and at one
> point Gustavo was trying to fix this [2], but had questions about the
> correct behavior when the associated peer_chan_len is 0.
> 
> I have been unable to determine if firmware requires that at least one
> record be present even if peer_chan_len is 0. But since that is the
> current behavior, follow the example from [3] and replace the
> one-element array with a union that contains both a flexible array and
> a single instance of the array element. This results in a struct that
> has the same footprint as the original, so no other 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/626ae2e7-66f8-423b-b17f-e75c1a6d29b3@embeddedor.com/
> [3] https://lore.kernel.org/linux-wireless/202308301529.AC90A9EF98@keescook/
> 
> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks!
--
Gustavo

> ---
>   drivers/net/wireless/ath/ath10k/wmi.h | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
> index e16410e348ca..b64b6e214bae 100644
> --- a/drivers/net/wireless/ath/ath10k/wmi.h
> +++ b/drivers/net/wireless/ath/ath10k/wmi.h
> @@ -7162,7 +7162,13 @@ struct wmi_tdls_peer_capabilities {
>   	__le32 is_peer_responder;
>   	__le32 pref_offchan_num;
>   	__le32 pref_offchan_bw;
> -	struct wmi_channel peer_chan_list[1];
> +	union {
> +		/* to match legacy implementation allocate room for
> +		 * at least one record even if peer_chan_len is 0
> +		 */
> +		struct wmi_channel peer_chan_min_allocation;
> +		DECLARE_FLEX_ARRAY(struct wmi_channel, peer_chan_list);
> +	};
>   } __packed;
>   
>   struct wmi_10_4_tdls_peer_update_cmd {
> 

  parent reply	other threads:[~2023-12-13 20:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 17:06 [PATCH 0/6] wifi: ath10k: use flexible arrays Jeff Johnson
2023-12-13 17:06 ` [PATCH 1/6] wifi: ath10k: use flexible array in struct wmi_host_mem_chunks Jeff Johnson
2023-12-13 19:10   ` Kees Cook
2023-12-13 20:14   ` Gustavo A. R. Silva
2023-12-18 18:47   ` Kalle Valo
2023-12-18 18:51     ` Gustavo A. R. Silva
2023-12-13 17:06 ` [PATCH 2/6] wifi: ath10k: use flexible arrays for WMI start scan TLVs Jeff Johnson
2023-12-13 19:11   ` Kees Cook
2023-12-13 20:17   ` Gustavo A. R. Silva
2023-12-13 17:06 ` [PATCH 3/6] wifi: ath10k: remove struct wmi_pdev_chanlist_update_event Jeff Johnson
2023-12-13 19:12   ` Kees Cook
2023-12-13 20:18   ` Gustavo A. R. Silva
2023-12-13 17:06 ` [PATCH 4/6] wifi: ath10k: remove unused template structs Jeff Johnson
2023-12-13 19:12   ` Kees Cook
2023-12-13 20:19   ` Gustavo A. R. Silva
2023-12-13 17:06 ` [PATCH 5/6] wifi: ath10k: use flexible array in struct wmi_tdls_peer_capabilities Jeff Johnson
2023-12-13 19:13   ` Kees Cook
2023-12-13 20:19   ` Gustavo A. R. Silva [this message]
2023-12-13 17:06 ` [PATCH 6/6] wifi: ath10k: remove duplicate memset() in 10.4 TDLS peer update Jeff Johnson
2023-12-13 19:16   ` Kees Cook
2023-12-13 19:36     ` Jeff Johnson
2023-12-13 19:37       ` Kees Cook
2023-12-13 20:20   ` Gustavo A. R. Silva
2023-12-13 20:21 ` [PATCH 0/6] wifi: ath10k: use flexible arrays Gustavo A. R. Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a015d185-ece0-4608-821d-061d1296d4e7@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=ath10k@lists.infradead.org \
    --cc=keescook@chromium.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_jjohnson@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox