Skip to contentSkip to conversation

ath6kl: replace one-element array with flexible-array member

PATCH In review Atul Raut 4 participants 7 messages Aug 4, 2023 – Aug 7, 2023 Atheros ATH6KL wireless driver

lore
Share & tools
lore

Atul Raut

author
#0 lore raw

PATCH v2 1/1 ath6kl: replace one-element array with flexible-array member

One-element arrays are no longer relevant, and their place has been taken by flexible array members thus, use a flexible-array member to replace the one-element array in struct ath6kl_usb_ctrl_diag_cmd_write

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)

---
 drivers/net/wireless/ath/ath6kl/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/usb.c +1 -1
index 5220809841a6..c8ecc9e85897 100644
@@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
 	__le32 cmd;
 	__le32 address;
 	__le32 value;
-	__le32 _pad[1];
+	__le32 _pad[];
 } __packed;
 
 struct ath6kl_usb_ctrl_diag_cmd_read {
Signature · 6 lines
2.34.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
#1 lore raw
Quoted 18 lines · Atul Raut

One-element arrays are no longer relevant, and their place has been taken by flexible array members thus, use a flexible-array member to replace the one-element array in struct ath6kl_usb_ctrl_diag_cmd_write

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)

---
 drivers/net/wireless/ath/ath6kl/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/usb.c +0 -0
index 5220809841a6..c8ecc9e85897 100644

drivers/net/wireless/ath/ath6kl/usb.c struct ath6kl_usb_ctrl_diag_cmd_write { · line 109

Quoted 5 lines
drivers/net/wireless/ath/ath6kl/usb.c +1 -1
@@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
 	__le32 cmd;
 	__le32 address;
 	__le32 value;
-	__le32 _pad[1];
+	__le32 _pad[];

Are you sure this is actually a variable length array?

And you just changed the size of this structure, are you sure this is correct?

There have been lots of work on this type of thing in the past on the hardening mailing list, I suggest you work there with the developers to see if this is even a valid change first.

thanks,

greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#2 lore raw
Quoted 15 lines · Greg KH
Quoted 13 lines · Atul Raut

One-element arrays are no longer relevant, and their place has been taken by flexible array members thus, use a flexible-array member to replace the one-element array in struct ath6kl_usb_ctrl_diag_cmd_write

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)

---
 drivers/net/wireless/ath/ath6kl/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/net/wireless/ath/ath6kl/usb.c struct ath6kl_usb_ctrl_diag_cmd_write { · line 109

Quoted 10 lines
drivers/net/wireless/ath/ath6kl/usb.c +1 -1
index 5220809841a6..c8ecc9e85897 100644
@@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
 	__le32 cmd;
 	__le32 address;
 	__le32 value;
-	__le32 _pad[1];
+	__le32 _pad[];

Are you sure this is actually a variable length array?

It's not, it's just padding. We both told this in v1:

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

Quoted 2 lines

And you just changed the size of this structure, are you sure this is correct?

This patch is not correct.

Atul, ALWAYS include a changelog when submitting a new version. Please carefully read our wiki link below before submitting new patches to wireless.

Signature · 7 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
#3 lore raw
Quoted 30 lines · Kalle Valo
Quoted 15 lines · Greg KH
Quoted 13 lines · Atul Raut

One-element arrays are no longer relevant, and their place has been taken by flexible array members thus, use a flexible-array member to replace the one-element array in struct ath6kl_usb_ctrl_diag_cmd_write

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)

---
 drivers/net/wireless/ath/ath6kl/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/net/wireless/ath/ath6kl/usb.c struct ath6kl_usb_ctrl_diag_cmd_write { · line 109

Quoted 10 lines
drivers/net/wireless/ath/ath6kl/usb.c +1 -1
index 5220809841a6..c8ecc9e85897 100644
@@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
 	__le32 cmd;
 	__le32 address;
 	__le32 value;
-	__le32 _pad[1];
+	__le32 _pad[];

Are you sure this is actually a variable length array?

Quoted 3 lines

It's not, it's just padding. We both told this in v1:

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

Hey, I'm consistent, nice! :)

But Atul, that's not good to ignore our review comments. Usually that ends up meaning that everyone will then just ignore your submissions, generally a not-good resolution.

thanks,

greg k-h
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#4 lore raw
Quoted 37 lines · Greg KH
Quoted 30 lines · Kalle Valo
Quoted 15 lines · Greg KH
Quoted 13 lines · Atul Raut

One-element arrays are no longer relevant, and their place has been taken by flexible array members thus, use a flexible-array member to replace the one-element array in struct ath6kl_usb_ctrl_diag_cmd_write

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)

---
  drivers/net/wireless/ath/ath6kl/usb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/net/wireless/ath/ath6kl/usb.c struct ath6kl_usb_ctrl_diag_cmd_write { · line 109

Quoted 10 lines
drivers/net/wireless/ath/ath6kl/usb.c +1 -1
index 5220809841a6..c8ecc9e85897 100644
@@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
  	__le32 cmd;
  	__le32 address;
  	__le32 value;
-	__le32 _pad[1];
+	__le32 _pad[];

Are you sure this is actually a variable length array?

Quoted 3 lines

It's not, it's just padding. We both told this in v1:

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

Hey, I'm consistent, nice! :)

Quoted 7 lines

But Atul, that's not good to ignore our review comments. Usually that ends up meaning that everyone will then just ignore your submissions, generally a not-good resolution.

thanks,

greg k-h

Since the 'pad' field is never directly accessed, suggest the author respin this this to use simply:

	__le32 _pad;

That will prevent others from trying to "fix" this actual one-element array in the future.

author
#5 lore raw
Quoted 50 lines · Jeff Johnson
Quoted 37 lines · Greg KH
Quoted 30 lines · Kalle Valo
Quoted 15 lines · Greg KH
Quoted 13 lines · Atul Raut

One-element arrays are no longer relevant, and their place has been taken by flexible array members thus, use a flexible-array member to replace the one-element array in struct ath6kl_usb_ctrl_diag_cmd_write

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)

---
 drivers/net/wireless/ath/ath6kl/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/net/wireless/ath/ath6kl/usb.c struct ath6kl_usb_ctrl_diag_cmd_write { · line 109

Quoted 10 lines
drivers/net/wireless/ath/ath6kl/usb.c +1 -1
index 5220809841a6..c8ecc9e85897 100644
@@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
 	__le32 cmd;
 	__le32 address;
 	__le32 value;
-	__le32 _pad[1];
+	__le32 _pad[];

Are you sure this is actually a variable length array?

Quoted 3 lines

It's not, it's just padding. We both told this in v1:

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

Hey, I'm consistent, nice! :)

Quoted 7 lines

But Atul, that's not good to ignore our review comments. Usually that ends up meaning that everyone will then just ignore your submissions, generally a not-good resolution.

thanks,

greg k-h

Since the 'pad' field is never directly accessed, suggest the author respin this this to use simply:

	__le32 _pad;

That will prevent others from trying to "fix" this actual one-element array in the future.

author
#6 lore raw
In reply to Jeff Johnson

Considering everyone's input/comments, will refrain from altering this or

other submitted patches, as advised.

-Atul

Quoted 43 lines · Jeff Johnson
Quoted 42 lines · Greg KH
Quoted 30 lines · Kalle Valo
Quoted 15 lines · Greg KH
Quoted 13 lines · Atul Raut

One-element arrays are no longer relevant, and their place has been taken by flexible array members thus, use a flexible-array member to replace the one-element array in struct ath6kl_usb_ctrl_diag_cmd_write

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)

---
  drivers/net/wireless/ath/ath6kl/usb.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/net/wireless/ath/ath6kl/usb.c struct ath6kl_usb_ctrl_diag_cmd_write { · line 109

Quoted 10 lines
drivers/net/wireless/ath/ath6kl/usb.c +1 -1
index 5220809841a6..c8ecc9e85897 100644
@@ -106,7 +106,7 @@ struct ath6kl_usb_ctrl_diag_cmd_write {
       __le32 cmd;
       __le32 address;
       __le32 value;
-    __le32 _pad[1];
+    __le32 _pad[];

Are you sure this is actually a variable length array?

Quoted 4 lines

It's not, it's just padding. We both told this in v1:

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

Hey, I'm consistent, nice!  :)

But Atul, that's not good to ignore our review comments. Usually that ends up meaning that everyone will then just ignore your submissions, generally a not-good resolution.

Quoted 8 lines
Quoted 3 lines

thanks,

greg k-h

Since the 'pad' field is never directly accessed, suggest the author respin this this to use simply:
    __le32 _pad;

That will prevent others from trying to "fix" this actual one-element array in the future.

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees