linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH 07/12] wifi: mwifiex: fix array of flexible structures warnings
Date: Tue, 6 Sep 2022 15:20:51 -0700	[thread overview]
Message-ID: <YxfHwxuwEP1rQoAU@google.com> (raw)
In-Reply-To: <20220904212910.2c885310ebee.If7177ea588b56c405eee6e6df595e9efccdfb99a@changeid>

Hi,

On Sun, Sep 04, 2022 at 09:29:07PM +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> There are two, just change them to have a "u8 data[]" type
> member, and add casts where needed. No binary changes.

Hmm, what exact warning are you looking at? This one?
https://clang.llvm.org/docs/DiagnosticsReference.html#wflexible-array-extensions

It's a little hard to suggest alternatives (or understand why this is
the only/best way) if I don't know what the alleged bug/warning is.

> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>  drivers/net/wireless/marvell/mwifiex/fw.h      | 4 ++--
>  drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h
> index 26a48d8f49be..b4f945a549f7 100644
> --- a/drivers/net/wireless/marvell/mwifiex/fw.h
> +++ b/drivers/net/wireless/marvell/mwifiex/fw.h
> @@ -2104,7 +2104,7 @@ struct mwifiex_fw_mef_entry {
>  struct host_cmd_ds_mef_cfg {
>  	__le32 criteria;
>  	__le16 num_entries;
> -	struct mwifiex_fw_mef_entry mef_entry[];
> +	u8 mef_entry_data[];

Do you actually need this part of the change? The 'mef_entry' (or
'mef_entry_data') field is not actually used anywhere now, but I can't
tell what kind of warning is involved.

But also see the next comment:

>  } __packed;
>  
>  #define CONNECTION_TYPE_INFRA   0
> @@ -2254,7 +2254,7 @@ struct coalesce_receive_filt_rule {
>  struct host_cmd_ds_coalesce_cfg {
>  	__le16 action;
>  	__le16 num_of_rules;
> -	struct coalesce_receive_filt_rule rule[];
> +	u8 rule_data[];

These kinds of changes seem to be losing some valuable information. At a
minimum, it would be nice to leave a comment that points at the intended
struct; but ideally, we'd be able to still get the type safety from
actually using the struct, instead of relying on casts and/or u8/void.

But I don't know if that's possible, as I'm not familiar with the
compiler warning involved.

Brian

  reply	other threads:[~2022-09-06 22:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-04 19:29 [PATCH 01/12] wifi: ipw2100: fix warnings about non-kernel-doc Johannes Berg
2022-09-04 19:29 ` [PATCH 02/12] wifi: ipw2x00: fix array of flexible structures warnings Johannes Berg
2022-09-05 15:38   ` Kalle Valo
2022-09-22  6:09   ` Kalle Valo
2022-09-04 19:29 ` [PATCH 03/12] wifi: libertas: fix a couple of sparse warnings Johannes Berg
2022-09-04 19:29 ` [PATCH 04/12] wifi: rndis_wlan: fix array of flexible structures warning Johannes Berg
2022-09-05 15:39   ` Kalle Valo
2022-09-04 19:29 ` [PATCH 05/12] wifi: wl18xx: add some missing endian conversions Johannes Berg
2022-09-04 19:29 ` [PATCH 06/12] wifi: mwifiex: mark a variable unused Johannes Berg
2022-09-04 19:29 ` [PATCH 07/12] wifi: mwifiex: fix array of flexible structures warnings Johannes Berg
2022-09-06 22:20   ` Brian Norris [this message]
2022-09-07  6:57     ` Johannes Berg
2022-09-09 20:45       ` Brian Norris
2022-09-10 14:40         ` Johannes Berg
2022-09-04 19:29 ` [PATCH 08/12] wifi: mwifiex: fix endian conversion Johannes Berg
2022-09-06 22:22   ` Brian Norris
2022-09-04 19:29 ` [PATCH 09/12] wifi: mwifiex: fix endian annotations in casts Johannes Berg
2022-09-06 22:21   ` Brian Norris
2022-09-04 19:29 ` [PATCH 10/12] wifi: cw1200: remove RCU STA pointer handling in TX Johannes Berg
2022-09-04 19:29 ` [PATCH 11/12] wifi: cw1200: use get_unaligned_le64() Johannes Berg
2022-09-04 19:29 ` [PATCH 12/12] wifi: b43: remove empty switch statement Johannes Berg
2022-09-07  8:03 ` [PATCH 01/12] wifi: ipw2100: fix warnings about non-kernel-doc Kalle Valo

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=YxfHwxuwEP1rQoAU@google.com \
    --to=briannorris@chromium.org \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).