2023-11-27 16:15:07

by Jeff Johnson

[permalink] [raw]
Subject: [PATCH 0/4] wifi: ath*: use DECLARE_FLEX_ARRAY() for ath*_htc_record

Fix ath10k_htc_record and ath11k_htc_record to remove an unused (and
misspelled) pauload member and to correctly use DECLARE_FLEX_ARRAY()
for the remaining flexible arrays. This helps with ongoing efforts to
globally enable -Warray-bounds.

---
Jeff Johnson (4):
wifi: ath10k: remove ath10k_htc_record::pauload[]
wifi: ath10k: Use DECLARE_FLEX_ARRAY() for ath10k_htc_record
wifi: ath11k: remove ath11k_htc_record::pauload[]
wifi: ath11k: Use DECLARE_FLEX_ARRAY() for ath11k_htc_record

drivers/net/wireless/ath/ath10k/htc.h | 7 +++----
drivers/net/wireless/ath/ath11k/htc.h | 3 +--
2 files changed, 4 insertions(+), 6 deletions(-)
---
base-commit: 8f157593689fcffc2d9b18af9472fce764188b43
change-id: 20231116-flexarray-htc_record-ae46f039d4bf



2023-11-27 16:15:09

by Jeff Johnson

[permalink] [raw]
Subject: [PATCH 3/4] wifi: ath11k: remove ath11k_htc_record::pauload[]

The misspelled pauload member of struct ath11k_htc_record is unused,
so remove it.

Signed-off-by: Jeff Johnson <[email protected]>
---
drivers/net/wireless/ath/ath11k/htc.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/htc.h b/drivers/net/wireless/ath/ath11k/htc.h
index d31e501c807c..84971cc9251c 100644
--- a/drivers/net/wireless/ath/ath11k/htc.h
+++ b/drivers/net/wireless/ath/ath11k/htc.h
@@ -152,7 +152,6 @@ struct ath11k_htc_record {
struct ath11k_htc_record_hdr hdr;
union {
struct ath11k_htc_credit_report credit_report[0];
- u8 pauload[0];
};
} __packed __aligned(4);


--
2.42.0


2023-11-27 16:15:14

by Jeff Johnson

[permalink] [raw]
Subject: [PATCH 1/4] wifi: ath10k: remove ath10k_htc_record::pauload[]

The misspelled pauload member of struct ath10k_htc_record is unused,
so remove it.

Signed-off-by: Jeff Johnson <[email protected]>
---
drivers/net/wireless/ath/ath10k/htc.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
index 0d180faf3b77..9cbb901d35e5 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -249,7 +249,6 @@ struct ath10k_htc_record {
struct ath10k_htc_credit_report credit_report[0];
struct ath10k_htc_lookahead_report lookahead_report[0];
struct ath10k_htc_lookahead_bundle lookahead_bundle[0];
- u8 pauload[0];
};
} __packed __aligned(4);


--
2.42.0


2023-11-27 16:15:33

by Jeff Johnson

[permalink] [raw]
Subject: [PATCH 4/4] wifi: ath11k: Use DECLARE_FLEX_ARRAY() for ath11k_htc_record

Transform the zero-length array in ath11k_htc_record into a proper
flexible array via the DECLARE_FLEX_ARRAY() macro. This helps with
ongoing efforts to globally enable -Warray-bounds.

Signed-off-by: Jeff Johnson <[email protected]>
---
drivers/net/wireless/ath/ath11k/htc.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/htc.h b/drivers/net/wireless/ath/ath11k/htc.h
index 84971cc9251c..e0434b29df70 100644
--- a/drivers/net/wireless/ath/ath11k/htc.h
+++ b/drivers/net/wireless/ath/ath11k/htc.h
@@ -151,7 +151,7 @@ struct ath11k_htc_credit_report {
struct ath11k_htc_record {
struct ath11k_htc_record_hdr hdr;
union {
- struct ath11k_htc_credit_report credit_report[0];
+ DECLARE_FLEX_ARRAY(struct ath11k_htc_credit_report, credit_report);
};
} __packed __aligned(4);


--
2.42.0


2023-11-27 16:23:20

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH 4/4] wifi: ath11k: Use DECLARE_FLEX_ARRAY() for ath11k_htc_record



On 11/27/23 10:14, Jeff Johnson wrote:
> Transform the zero-length array in ath11k_htc_record into a proper
> flexible array via the DECLARE_FLEX_ARRAY() macro. This helps with
> ongoing efforts to globally enable -Warray-bounds.
>
> Signed-off-by: Jeff Johnson <[email protected]>
> ---
> drivers/net/wireless/ath/ath11k/htc.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/htc.h b/drivers/net/wireless/ath/ath11k/htc.h
> index 84971cc9251c..e0434b29df70 100644
> --- a/drivers/net/wireless/ath/ath11k/htc.h
> +++ b/drivers/net/wireless/ath/ath11k/htc.h
> @@ -151,7 +151,7 @@ struct ath11k_htc_credit_report {
> struct ath11k_htc_record {
> struct ath11k_htc_record_hdr hdr;
> union {
> - struct ath11k_htc_credit_report credit_report[0];
> + DECLARE_FLEX_ARRAY(struct ath11k_htc_credit_report, credit_report);
> };

Why not removing the `union` and just do a direct transformation [0] -> [ ] ?

--
Gustavo


2023-11-27 16:33:14

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH 4/4] wifi: ath11k: Use DECLARE_FLEX_ARRAY() for ath11k_htc_record

On 11/27/2023 8:23 AM, Gustavo A. R. Silva wrote:
>
>
> On 11/27/23 10:14, Jeff Johnson wrote:
>> Transform the zero-length array in ath11k_htc_record into a proper
>> flexible array via the DECLARE_FLEX_ARRAY() macro. This helps with
>> ongoing efforts to globally enable -Warray-bounds.
>>
>> Signed-off-by: Jeff Johnson <[email protected]>
>> ---
>> drivers/net/wireless/ath/ath11k/htc.h | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/htc.h b/drivers/net/wireless/ath/ath11k/htc.h
>> index 84971cc9251c..e0434b29df70 100644
>> --- a/drivers/net/wireless/ath/ath11k/htc.h
>> +++ b/drivers/net/wireless/ath/ath11k/htc.h
>> @@ -151,7 +151,7 @@ struct ath11k_htc_credit_report {
>> struct ath11k_htc_record {
>> struct ath11k_htc_record_hdr hdr;
>> union {
>> - struct ath11k_htc_credit_report credit_report[0];
>> + DECLARE_FLEX_ARRAY(struct ath11k_htc_credit_report, credit_report);
>> };
>
> Why not removing the `union` and just do a direct transformation [0] -> [ ] ?

No reason other than staying consistent with ath10k.
Will see if Kalle has an opinion on this.

/jeff

2023-11-30 17:02:43

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/4] wifi: ath10k: remove ath10k_htc_record::pauload[]

Jeff Johnson <[email protected]> wrote:

> The misspelled pauload member of struct ath10k_htc_record is unused,
> so remove it.
>
> Signed-off-by: Jeff Johnson <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

3 patches applied to ath-next branch of ath.git, thanks.

c7876faa91ab wifi: ath10k: remove ath10k_htc_record::pauload[]
7b4df59fced0 wifi: ath10k: Use DECLARE_FLEX_ARRAY() for ath10k_htc_record
f20eb4cb9324 wifi: ath11k: remove ath11k_htc_record::pauload[]

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


2023-12-05 15:29:16

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 4/4] wifi: ath11k: Use DECLARE_FLEX_ARRAY() for ath11k_htc_record

Jeff Johnson <[email protected]> writes:

> On 11/27/2023 8:23 AM, Gustavo A. R. Silva wrote:
>
>>
>>
>> On 11/27/23 10:14, Jeff Johnson wrote:
>>> Transform the zero-length array in ath11k_htc_record into a proper
>>> flexible array via the DECLARE_FLEX_ARRAY() macro. This helps with
>>> ongoing efforts to globally enable -Warray-bounds.
>>>
>>> Signed-off-by: Jeff Johnson <[email protected]>
>>> ---
>>> drivers/net/wireless/ath/ath11k/htc.h | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/wireless/ath/ath11k/htc.h b/drivers/net/wireless/ath/ath11k/htc.h
>>> index 84971cc9251c..e0434b29df70 100644
>>> --- a/drivers/net/wireless/ath/ath11k/htc.h
>>> +++ b/drivers/net/wireless/ath/ath11k/htc.h
>>> @@ -151,7 +151,7 @@ struct ath11k_htc_credit_report {
>>> struct ath11k_htc_record {
>>> struct ath11k_htc_record_hdr hdr;
>>> union {
>>> - struct ath11k_htc_credit_report credit_report[0];
>>> + DECLARE_FLEX_ARRAY(struct ath11k_htc_credit_report, credit_report);
>>> };
>>
>> Why not removing the `union` and just do a direct transformation [0] -> [ ] ?
>
> No reason other than staying consistent with ath10k.
> Will see if Kalle has an opinion on this.

Yeah, I don't see the need for the union and I removed it in the pending
branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=a2faeea1fe0635563187e7821a6d0baf7b40f2c6

Does it look ok?

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2023-12-05 15:46:09

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH 4/4] wifi: ath11k: Use DECLARE_FLEX_ARRAY() for ath11k_htc_record



On 12/5/23 09:29, Kalle Valo wrote:
> Jeff Johnson <[email protected]> writes:
>
>> On 11/27/2023 8:23 AM, Gustavo A. R. Silva wrote:
>>
>>>
>>>
>>> On 11/27/23 10:14, Jeff Johnson wrote:
>>>> Transform the zero-length array in ath11k_htc_record into a proper
>>>> flexible array via the DECLARE_FLEX_ARRAY() macro. This helps with
>>>> ongoing efforts to globally enable -Warray-bounds.
>>>>
>>>> Signed-off-by: Jeff Johnson <[email protected]>
>>>> ---
>>>> drivers/net/wireless/ath/ath11k/htc.h | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/wireless/ath/ath11k/htc.h b/drivers/net/wireless/ath/ath11k/htc.h
>>>> index 84971cc9251c..e0434b29df70 100644
>>>> --- a/drivers/net/wireless/ath/ath11k/htc.h
>>>> +++ b/drivers/net/wireless/ath/ath11k/htc.h
>>>> @@ -151,7 +151,7 @@ struct ath11k_htc_credit_report {
>>>> struct ath11k_htc_record {
>>>> struct ath11k_htc_record_hdr hdr;
>>>> union {
>>>> - struct ath11k_htc_credit_report credit_report[0];
>>>> + DECLARE_FLEX_ARRAY(struct ath11k_htc_credit_report, credit_report);
>>>> };
>>>
>>> Why not removing the `union` and just do a direct transformation [0] -> [ ] ?
>>
>> No reason other than staying consistent with ath10k.
>> Will see if Kalle has an opinion on this.
>
> Yeah, I don't see the need for the union and I removed it in the pending
> branch:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=a2faeea1fe0635563187e7821a6d0baf7b40f2c6
>
> Does it look ok?
>

Nope.

A direct transformation is just fine:

- union {
- struct ath11k_htc_credit_report credit_report[0];
- };
+ struct ath11k_htc_credit_report credit_report[];

There is no need for DFA in this situation.

Thanks
--
Gustavo

2023-12-05 20:00:21

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 4/4] wifi: ath11k: Use DECLARE_FLEX_ARRAY() for ath11k_htc_record

"Gustavo A. R. Silva" <[email protected]> writes:

> On 12/5/23 09:29, Kalle Valo wrote:
>> Jeff Johnson <[email protected]> writes:
>>
>>> On 11/27/2023 8:23 AM, Gustavo A. R. Silva wrote:
>>>
>>>>
>>>>
>>>> On 11/27/23 10:14, Jeff Johnson wrote:
>>>>> Transform the zero-length array in ath11k_htc_record into a proper
>>>>> flexible array via the DECLARE_FLEX_ARRAY() macro. This helps with
>>>>> ongoing efforts to globally enable -Warray-bounds.
>>>>>
>>>>> Signed-off-by: Jeff Johnson <[email protected]>
>>>>> ---
>>>>> drivers/net/wireless/ath/ath11k/htc.h | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/net/wireless/ath/ath11k/htc.h b/drivers/net/wireless/ath/ath11k/htc.h
>>>>> index 84971cc9251c..e0434b29df70 100644
>>>>> --- a/drivers/net/wireless/ath/ath11k/htc.h
>>>>> +++ b/drivers/net/wireless/ath/ath11k/htc.h
>>>>> @@ -151,7 +151,7 @@ struct ath11k_htc_credit_report {
>>>>> struct ath11k_htc_record {
>>>>> struct ath11k_htc_record_hdr hdr;
>>>>> union {
>>>>> - struct ath11k_htc_credit_report credit_report[0];
>>>>> + DECLARE_FLEX_ARRAY(struct ath11k_htc_credit_report, credit_report);
>>>>> };
>>>>
>>>> Why not removing the `union` and just do a direct transformation [0] -> [ ] ?
>>>
>>> No reason other than staying consistent with ath10k.
>>> Will see if Kalle has an opinion on this.
>> Yeah, I don't see the need for the union and I removed it in the
>> pending
>> branch:
>> https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=a2faeea1fe0635563187e7821a6d0baf7b40f2c6
>> Does it look ok?
>>
>
> Nope.
>
> A direct transformation is just fine:
>
> - union {
> - struct ath11k_htc_credit_report credit_report[0];
> - };
> + struct ath11k_htc_credit_report credit_report[];
>
> There is no need for DFA in this situation.

Sorry, I read your comments too hastily. Jeff, as I'm offline tomorrow
would you mind submitting v2?

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches