linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member
@ 2023-03-24  1:11 Gustavo A. R. Silva
  2023-03-24 12:53 ` Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Gustavo A. R. Silva @ 2023-03-24  1:11 UTC (permalink / raw)
  To: Ping-Ke Shih, Kalle Valo, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-wireless, netdev, linux-kernel, Gustavo A. R. Silva,
	linux-hardening

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].

Link: https://github.com/KSPP/linux/issues/21
Link: https://github.com/KSPP/linux/issues/277
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index 31f9e9e5c680..082af216760f 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -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


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

* Re: [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member
  2023-03-24  1:11 [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member Gustavo A. R. Silva
@ 2023-03-24 12:53 ` Simon Horman
  2023-03-27  0:35 ` Ping-Ke Shih
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2023-03-24 12:53 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Ping-Ke Shih, Kalle Valo, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-wireless, netdev,
	linux-kernel, linux-hardening

On Thu, Mar 23, 2023 at 07:11:35PM -0600, Gustavo A. R. Silva wrote:
> 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].
> 
> Link: https://github.com/KSPP/linux/issues/21
> Link: https://github.com/KSPP/linux/issues/277
> Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


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

* RE: [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member
  2023-03-24  1:11 [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member Gustavo A. R. Silva
  2023-03-24 12:53 ` Simon Horman
@ 2023-03-27  0:35 ` Ping-Ke Shih
  2023-03-30 20:04 ` Gustavo A. R. Silva
  2023-03-31 14:49 ` [next] wifi: " Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Ping-Ke Shih @ 2023-03-27  0:35 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Kalle Valo, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: linux-wireless, netdev, linux-kernel, linux-hardening



> -----Original Message-----
> From: Gustavo A. R. Silva <gustavoars@kernel.org>
> Sent: Friday, March 24, 2023 9:12 AM
> To: Ping-Ke Shih <pkshih@realtek.com>; Kalle Valo <kvalo@kernel.org>; David S. Miller <davem@davemloft.net>;
> Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>
> Cc: linux-wireless@vger.kernel.org; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Gustavo A. R.
> Silva <gustavoars@kernel.org>; linux-hardening@vger.kernel.org
> 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);
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 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].
> 
> Link: https://github.com/KSPP/linux/issues/21
> Link: https://github.com/KSPP/linux/issues/277
> Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

> ---
>  drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> index 31f9e9e5c680..082af216760f 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
> +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> @@ -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.

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

* Re: [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member
  2023-03-24  1:11 [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member Gustavo A. R. Silva
  2023-03-24 12:53 ` Simon Horman
  2023-03-27  0:35 ` Ping-Ke Shih
@ 2023-03-30 20:04 ` Gustavo A. R. Silva
  2023-03-31 14:26   ` Kalle Valo
  2023-03-31 14:49 ` [next] wifi: " Kalle Valo
  3 siblings, 1 reply; 6+ messages in thread
From: Gustavo A. R. Silva @ 2023-03-30 20:04 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Ping-Ke Shih, Kalle Valo, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-wireless, netdev, linux-kernel, linux-hardening

Hi all,

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

Thanks
--
Gustavo

On 3/23/23 19:11, Gustavo A. R. Silva wrote:
> 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].
> 
> Link: https://github.com/KSPP/linux/issues/21
> Link: https://github.com/KSPP/linux/issues/277
> Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>   drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> index 31f9e9e5c680..082af216760f 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
> +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
> @@ -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))

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

* Re: [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member
  2023-03-30 20:04 ` Gustavo A. R. Silva
@ 2023-03-31 14:26   ` Kalle Valo
  0 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2023-03-31 14:26 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Gustavo A. R. Silva, Ping-Ke Shih, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-wireless, netdev,
	linux-kernel, linux-hardening

"Gustavo A. R. Silva" <gustavo@embeddedor.com> writes:

> 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.

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

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

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

* Re: [next] wifi: rtlwifi: Replace fake flex-array with flex-array member
  2023-03-24  1:11 [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member Gustavo A. R. Silva
                   ` (2 preceding siblings ...)
  2023-03-30 20:04 ` Gustavo A. R. Silva
@ 2023-03-31 14:49 ` Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2023-03-31 14:49 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Ping-Ke Shih, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-wireless, netdev, linux-kernel,
	Gustavo A. R. Silva, linux-hardening

"Gustavo A. R. Silva" <gustavoars@kernel.org> wrote:

> 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].
> 
> Link: https://github.com/KSPP/linux/issues/21
> Link: https://github.com/KSPP/linux/issues/277
> Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1]
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

Patch applied to wireless-next.git, thanks.

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

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

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


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

end of thread, other threads:[~2023-03-31 14:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-24  1:11 [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member Gustavo A. R. Silva
2023-03-24 12:53 ` Simon Horman
2023-03-27  0:35 ` Ping-Ke Shih
2023-03-30 20:04 ` Gustavo A. R. Silva
2023-03-31 14:26   ` Kalle Valo
2023-03-31 14:49 ` [next] wifi: " 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).