* [PATCH] ath6kl: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper
@ 2023-07-31 1:29 Atul Raut
2023-07-31 6:05 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Atul Raut @ 2023-07-31 1:29 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, linux-kernel, linux-kernel-mentees
Because zero-length arrays are obsolete, replacing them with
C99 flexible-array members.
Instead of defining a zero-length array, use the new
DECLARE_FLEX_ARRAY() auxiliary macro.
This fixes warnings such as:
./drivers/net/wireless/ath/ath6kl/usb.c:109:8-12: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Signed-off-by: Atul Raut <rauji.raut@gmail.com>
---
drivers/net/wireless/ath/ath6kl/usb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
index 5220809841a6..bb3771a3897c 100644
--- a/drivers/net/wireless/ath/ath6kl/usb.c
+++ b/drivers/net/wireless/ath/ath6kl/usb.c
@@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
__le32 cmd;
__le32 address;
__le32 value;
- __le32 _pad[1];
+ DECLARE_FLEX_ARRAY(__le32, _pad);
} __packed;
struct ath6kl_usb_ctrl_diag_cmd_read {
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ath6kl: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper
2023-07-31 1:29 [PATCH] ath6kl: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper Atul Raut
@ 2023-07-31 6:05 ` Greg KH
2023-08-01 14:42 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2023-07-31 6:05 UTC (permalink / raw)
To: Atul Raut; +Cc: kvalo, linux-kernel-mentees, linux-wireless, linux-kernel
On Sun, Jul 30, 2023 at 06:29:41PM -0700, Atul Raut wrote:
> Because zero-length arrays are obsolete, replacing them with
> C99 flexible-array members.
> Instead of defining a zero-length array, use the new
> DECLARE_FLEX_ARRAY() auxiliary macro.
>
> This fixes warnings such as:
> ./drivers/net/wireless/ath/ath6kl/usb.c:109:8-12: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
>
> Signed-off-by: Atul Raut <rauji.raut@gmail.com>
> ---
> drivers/net/wireless/ath/ath6kl/usb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
> index 5220809841a6..bb3771a3897c 100644
> --- a/drivers/net/wireless/ath/ath6kl/usb.c
> +++ b/drivers/net/wireless/ath/ath6kl/usb.c
> @@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
> __le32 cmd;
> __le32 address;
> __le32 value;
> - __le32 _pad[1];
> + DECLARE_FLEX_ARRAY(__le32, _pad);
This is not a 0 length array, or a variable array. Look at the work
done on the hardening mailing list for more details, I think this is
wrong.
good luck!
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ath6kl: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper
2023-07-31 6:05 ` Greg KH
@ 2023-08-01 14:42 ` Kalle Valo
0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-08-01 14:42 UTC (permalink / raw)
To: Greg KH; +Cc: Atul Raut, linux-kernel-mentees, linux-wireless, linux-kernel
Greg KH <greg@kroah.com> writes:
> On Sun, Jul 30, 2023 at 06:29:41PM -0700, Atul Raut wrote:
>
>> Because zero-length arrays are obsolete, replacing them with
>> C99 flexible-array members.
>> Instead of defining a zero-length array, use the new
>> DECLARE_FLEX_ARRAY() auxiliary macro.
>>
>> This fixes warnings such as:
>> ./drivers/net/wireless/ath/ath6kl/usb.c:109:8-12: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
>>
>> Signed-off-by: Atul Raut <rauji.raut@gmail.com>
>> ---
>> drivers/net/wireless/ath/ath6kl/usb.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
>> index 5220809841a6..bb3771a3897c 100644
>> --- a/drivers/net/wireless/ath/ath6kl/usb.c
>> +++ b/drivers/net/wireless/ath/ath6kl/usb.c
>> @@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
>> __le32 cmd;
>> __le32 address;
>> __le32 value;
>> - __le32 _pad[1];
>> + DECLARE_FLEX_ARRAY(__le32, _pad);
>
> This is not a 0 length array, or a variable array. Look at the work
> done on the hardening mailing list for more details, I think this is
> wrong.
I agree with Greg, this is just padding and _pad is not even used
anywhere in ath6kl. Though use of [1] is strange here, '__le32 _pad;'
would be enough.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-01 14:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-31 1:29 [PATCH] ath6kl: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper Atul Raut
2023-07-31 6:05 ` Greg KH
2023-08-01 14:42 ` Kalle Valo
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).