2024-03-19 22:02:41

by Gustavo A. R. Silva

[permalink] [raw]
Subject: [RFC] wireless: ti: Can we just remove this flexible array?

Hi!

`struct wl1271_cmd_header` is currently embedded in multiple other
structs, and it's causing many `-Wflex-array-member-not-at-end` warnings.

Has this flexible-array member been used in the past or is it intended
for future use?

Otherwise, I think we could just remove it.

diff --git a/drivers/net/wireless/ti/wlcore/cmd.h b/drivers/net/wireless/ti/wlcore/cmd.h
index f2609d5b6bf7..4c2f2608ef3b 100644
--- a/drivers/net/wireless/ti/wlcore/cmd.h
+++ b/drivers/net/wireless/ti/wlcore/cmd.h
@@ -208,8 +208,6 @@ enum cmd_templ {
struct wl1271_cmd_header {
__le16 id;
__le16 status;
- /* payload */
- u8 data[];
} __packed;


Thanks!
--
Gustavo


2024-03-19 22:55:37

by Jeff Johnson

[permalink] [raw]
Subject: Re: [RFC] wireless: ti: Can we just remove this flexible array?

On 3/19/2024 2:59 PM, Gustavo A. R. Silva wrote:
> Hi!
>
> `struct wl1271_cmd_header` is currently embedded in multiple other
> structs, and it's causing many `-Wflex-array-member-not-at-end` warnings.
>
> Has this flexible-array member been used in the past or is it intended
> for future use?
>
> Otherwise, I think we could just remove it.
>
> diff --git a/drivers/net/wireless/ti/wlcore/cmd.h b/drivers/net/wireless/ti/wlcore/cmd.h
> index f2609d5b6bf7..4c2f2608ef3b 100644
> --- a/drivers/net/wireless/ti/wlcore/cmd.h
> +++ b/drivers/net/wireless/ti/wlcore/cmd.h
> @@ -208,8 +208,6 @@ enum cmd_templ {
> struct wl1271_cmd_header {
> __le16 id;
> __le16 status;
> - /* payload */
> - u8 data[];
> } __packed;

I'd think you should just remove it



2024-03-20 09:03:55

by Johannes Berg

[permalink] [raw]
Subject: Re: [RFC] wireless: ti: Can we just remove this flexible array?

On Tue, 2024-03-19 at 18:42 -0600, Gustavo A. R. Silva wrote:
>
> > > - /* payload */
> > > - u8 data[];
> > > } __packed;
> >

Why not keep (or even add in the cases where it's not) the comment
though?

johannes