[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3190a6c23f9a468d90688f2704d36fa1@realtek.com>
Date: Mon, 27 Mar 2023 00:35:22 +0000
From: Ping-Ke Shih <pkshih@...ltek.com>
To: "Gustavo A. R. Silva" <gustavoars@...nel.org>,
Kalle Valo <kvalo@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
CC: "linux-wireless@...r.kernel.org" <linux-wireless@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>
Subject: RE: [PATCH][next] rtlwifi: Replace fake flex-array with flex-array member
> -----Original Message-----
> From: Gustavo A. R. Silva <gustavoars@...nel.org>
> Sent: Friday, March 24, 2023 9:12 AM
> To: Ping-Ke Shih <pkshih@...ltek.com>; Kalle Valo <kvalo@...nel.org>; David S. Miller <davem@...emloft.net>;
> Eric Dumazet <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Paolo Abeni <pabeni@...hat.com>
> Cc: linux-wireless@...r.kernel.org; netdev@...r.kernel.org; linux-kernel@...r.kernel.org; Gustavo A. R.
> Silva <gustavoars@...nel.org>; linux-hardening@...r.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@...nel.org>
Acked-by: Ping-Ke Shih <pkshih@...ltek.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.
Powered by blists - more mailing lists