Skip to contentSkip to conversation

rtlwifi: Replace fake flex-array with flex-array member

PATCH In review Gustavo A. R. Silva 5 participants 6 messages Mar 24, 2023 – Mar 31, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtlwifi: Replace fake flex-array with flex-array member

Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.

Address the following warning found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
In function ‘fortify_memset_chk’,
inlined from ‘rtl_usb_probe’ at drivers/net/wireless/realtek/rtlwifi/usb.c:1044:2:
./include/linux/fortify-string.h:430:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]

  430 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].

---
 drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/wifi.h +1 -1
index 31f9e9e5c680..082af216760f 100644
@@ -2831,7 +2831,7 @@ struct rtl_priv {
 	 * beyond  this structure like:
 	 * rtl_pci_priv or rtl_usb_priv
 	 */
-	u8 priv[0] __aligned(sizeof(void *));
+	u8 priv[] __aligned(sizeof(void *));
 };
 
 #define rtl_priv(hw)		(((struct rtl_priv *)(hw)->priv))
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Gustavo A. R. Silva

Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.

Address the following warning found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
In function ‘fortify_memset_chk’,
inlined from ‘rtl_usb_probe’ at drivers/net/wireless/realtek/rtlwifi/usb.c:1044:2:
./include/linux/fortify-string.h:430:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]

  430 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 24 lines

-----Original Message-----
From: Gustavo A. R. Silva <[email protected]>
Sent: Friday, March 24, 2023 9:12 AM
To: Ping-Ke Shih <[email protected]>; Kalle Valo <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Gustavo A. R. Silva <[email protected]>; [email protected]
Subject: [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member

Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.

Address the following warning found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
In function ‘fortify_memset_chk’,
inlined from ‘rtl_usb_probe’ at drivers/net/wireless/realtek/rtlwifi/usb.c:1044:2:
./include/linux/fortify-string.h:430:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]

  430 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 8 lines

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].

Quoted 22 lines
---
 drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/wifi.h +1 -2
index 31f9e9e5c680..082af216760f 100644
@@ -2831,7 +2831,7 @@ struct rtl_priv {
         * beyond  this structure like:
         * rtl_pci_priv or rtl_usb_priv
         */
-       u8 priv[0] __aligned(sizeof(void *));
+       u8 priv[] __aligned(sizeof(void *));
 };
 
 #define rtl_priv(hw)           (((struct rtl_priv *)(hw)->priv))
--

2.34.1

------Please consider the environment before printing this e-mail.

#3 lore raw
In reply to Gustavo A. R. Silva

Hi all,

Friendly ping: who can take this, please? :)

Thanks
--
Gustavo

Quoted 36 lines · Gustavo A. R. Silva

Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.

Address the following warning found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
In function ‘fortify_memset_chk’,
inlined from ‘rtl_usb_probe’ at drivers/net/wireless/realtek/rtlwifi/usb.c:1044:2:
./include/linux/fortify-string.h:430:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]

   430 |                         __write_overflow_field(p_size_field, size);
       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].

---
  drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/wifi.h +1 -1
index 31f9e9e5c680..082af216760f 100644
@@ -2831,7 +2831,7 @@ struct rtl_priv {
  	 * beyond  this structure like:
  	 * rtl_pci_priv or rtl_usb_priv
  	 */
-	u8 priv[0] __aligned(sizeof(void *));
+	u8 priv[] __aligned(sizeof(void *));
  };
 
  #define rtl_priv(hw)		(((struct rtl_priv *)(hw)->priv))
#4 lore raw
Quoted 1 line · Gustavo A. R. Silva

Friendly ping: who can take this, please? :)

rtlwifi patches go through wireless-next, so usually me.

Please be patient, it's only a week since you submitted the patch. We sometimes are busy and cannot take patches immeadiately. These friendly pings are just annoying, you can check the state of a wireless patch from the patchwork link below.

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#5 lore raw

Re: [next] wifi: rtlwifi: Replace fake flex-array with flex-array member

In reply to Gustavo A. R. Silva
Quoted 15 lines · Gustavo A. R. Silva

Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead.

Address the following warning found with GCC-13 and
-fstrict-flex-arrays=3 enabled:
In function ‘fortify_memset_chk’,
inlined from ‘rtl_usb_probe’ at drivers/net/wireless/realtek/rtlwifi/usb.c:1044:2:
./include/linux/fortify-string.h:430:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]

  430 |                         __write_overflow_field(p_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].

Quoted 6 lines

Patch applied to wireless-next.git, thanks.

82d6077901c6 wifi: rtlwifi: Replace fake flex-array with flex-array member

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/ZBz4x+MWoI/f65o1@work/

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