public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] wireless: ti: Can we just remove this flexible array?
@ 2024-03-19 21:59 Gustavo A. R. Silva
  2024-03-19 22:54 ` Jeff Johnson
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2024-03-19 21:59 UTC (permalink / raw)
  To: Kalle Valo; +Cc: linux-wireless, LKML, linux-hardening

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC] wireless: ti: Can we just remove this flexible array?
  2024-03-19 21:59 [RFC] wireless: ti: Can we just remove this flexible array? Gustavo A. R. Silva
@ 2024-03-19 22:54 ` Jeff Johnson
  2024-03-20  0:42   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Johnson @ 2024-03-19 22:54 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Kalle Valo; +Cc: linux-wireless, LKML, linux-hardening

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] wireless: ti: Can we just remove this flexible array?
  2024-03-19 22:54 ` Jeff Johnson
@ 2024-03-20  0:42   ` Gustavo A. R. Silva
  2024-03-20  9:03     ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2024-03-20  0:42 UTC (permalink / raw)
  To: Jeff Johnson, Kalle Valo; +Cc: linux-wireless, LKML, linux-hardening



On 3/19/24 16:54, Jeff Johnson wrote:
> 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
> 

Yep, I think I'm actually going to remove a few more:

diff --git a/drivers/net/wireless/ti/wl1251/cmd.h b/drivers/net/wireless/ti/wl1251/cmd.h
index e5874186f9d7..39159201b97e 100644
--- a/drivers/net/wireless/ti/wl1251/cmd.h
+++ b/drivers/net/wireless/ti/wl1251/cmd.h
@@ -89,8 +89,6 @@ enum wl1251_commands {
  struct wl1251_cmd_header {
         u16 id;
         u16 status;
-       /* payload */
-       u8 data[];
  } __packed;

  struct  wl1251_command {
diff --git a/drivers/net/wireless/ti/wl1251/wl12xx_80211.h b/drivers/net/wireless/ti/wl1251/wl12xx_80211.h
index 7e28fe435b43..3d5b0df5b231 100644
--- a/drivers/net/wireless/ti/wl1251/wl12xx_80211.h
+++ b/drivers/net/wireless/ti/wl1251/wl12xx_80211.h
@@ -65,7 +65,6 @@ struct ieee80211_header {
         u8 sa[ETH_ALEN];
         u8 bssid[ETH_ALEN];
         __le16 seq_ctl;
-       u8 payload[];
  } __packed;

  struct wl12xx_ie_header {
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;

  #define WL1271_CMD_MAX_PARAMS 572
diff --git a/drivers/net/wireless/ti/wlcore/wl12xx_80211.h b/drivers/net/wireless/ti/wlcore/wl12xx_80211.h
index 1dd7ecc11f86..602915c4da26 100644
--- a/drivers/net/wireless/ti/wlcore/wl12xx_80211.h
+++ b/drivers/net/wireless/ti/wlcore/wl12xx_80211.h
@@ -66,7 +66,6 @@ struct ieee80211_header {
         u8 sa[ETH_ALEN];
         u8 bssid[ETH_ALEN];
         __le16 seq_ctl;
-       u8 payload[];
  } __packed;

  struct wl12xx_ie_header {

--
Gustavo

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC] wireless: ti: Can we just remove this flexible array?
  2024-03-20  0:42   ` Gustavo A. R. Silva
@ 2024-03-20  9:03     ` Johannes Berg
  2024-03-20 17:10       ` Jeff Johnson
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2024-03-20  9:03 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Jeff Johnson, Kalle Valo
  Cc: linux-wireless, LKML, linux-hardening

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] wireless: ti: Can we just remove this flexible array?
  2024-03-20  9:03     ` Johannes Berg
@ 2024-03-20 17:10       ` Jeff Johnson
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Johnson @ 2024-03-20 17:10 UTC (permalink / raw)
  To: Johannes Berg, Gustavo A. R. Silva, Kalle Valo
  Cc: linux-wireless, LKML, linux-hardening

On 3/20/2024 2:03 AM, Johannes Berg wrote:
> 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?

For something called <foo>_header isn't it implicit that something will
probably follow?


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-20 17:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-19 21:59 [RFC] wireless: ti: Can we just remove this flexible array? Gustavo A. R. Silva
2024-03-19 22:54 ` Jeff Johnson
2024-03-20  0:42   ` Gustavo A. R. Silva
2024-03-20  9:03     ` Johannes Berg
2024-03-20 17:10       ` Jeff Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox