rtw89: use flexible array member in rtw89_btc_btf_tlv
PATCH 1/1 rtw89: use flexible array member in rtw89_btc_btf_tlv
From: Arnd Bergmann <[email protected]>
struct rtw89_btc_btf_tlv contains a one-byte member that is intended as a flexible array:
In function 'fortify_memcpy_chk',
inlined from '_append_tdma' at drivers/net/wireless/realtek/rtw89/coex.c:1579:3:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning]
583 | __write_overflow_field(p_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Make this actually use a flexible array to let the compiler understand.
--- drivers/net/wireless/realtek/rtw89/coex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/coex.c +1 -1
@@ -206,7 +206,7 @@ static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = {struct rtw89_btc_btf_tlv {u8 type;u8 len; -u8 val[1 ]; +u8 val[]; } __packed;enum btc_btf_set_report_en {
Signature · 1 line
2.39.2
Quoted 20 lines
-----Original Message-----
From: Arnd Bergmann <[email protected]>
Sent: Tuesday, May 23, 2023 7:33 PM
To: Ping-Ke Shih <[email protected]>; Kalle Valo <[email protected]>
Cc: Arnd Bergmann <[email protected]>; DeanKu <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] rtw89: use flexible array member inrtw89_btc_btf_tlvFrom: Arnd Bergmann <[email protected]>
struct
rtw89_btc_btf_tlvcontains a one-byte member that is intended as a flexible array:In function '
fortify_memcpy_chk',
inlined from '_append_tdma' atdrivers/net/wireless/realtek/rtw89/coex.c:1579:3:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute
warning: detected write beyond size of field (1st parameter); maybe usestruct_group()? [-Werror=attribute-warning]
Quoted 6 lines
583 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Make this actually use a flexible array to let the compiler understand.
Signed-off-by Arnd Bergmann <[email protected]>
Quoted 19 lines
--- drivers/net/wireless/realtek/rtw89/coex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/realtek/rtw89/coex.c +1
-2@@ -206,7 +206,7 @@ static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = {struct rtw89_btc_btf_tlv {u8 type;u8 len; -u8 val[1 ]; +u8 val[]; } __packed;enum btc_btf_set_report_en { --2.39.2
Quoted 8 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
struct
rtw89_btc_btf_tlvcontains a one-byte member that is intended as a flexible array:In function '
fortify_memcpy_chk',
inlined from '_append_tdma' atdrivers/net/wireless/realtek/rtw89/coex.c:1579:3:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe usestruct_group()? [-Werror=attribute-warning]
Quoted 6 lines
583 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Make this actually use a flexible array to let the compiler understand.
Signed-off-by Arnd Bergmann <[email protected]>
Thanks!
--
Gustavo
Quoted 17 lines
--- drivers/net/wireless/realtek/rtw89/coex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/realtek/rtw89/coex.c +1
-1@@ -206,7 +206,7 @@ static const struct rtw89_btc_ver rtw89_btc_ver_defs[] = {struct rtw89_btc_btf_tlv {u8 type;u8 len; -u8 val[1 ]; +u8 val[]; } __packed;enum btc_btf_set_report_en {
Re: wifi: rtw89: use flexible array member in rtw89_btc_btf_tlv
In reply to Arnd BergmannQuoted 8 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
struct
rtw89_btc_btf_tlvcontains a one-byte member that is intended as a flexible array:In function '
fortify_memcpy_chk',
inlined from '_append_tdma' atdrivers/net/wireless/realtek/rtw89/coex.c:1579:3:include/linux/fortify-string.h:583:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe usestruct_group()? [-Werror=attribute-warning]
Quoted 8 lines
583 | __write_overflow_field(p_size_field, size); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Make this actually use a flexible array to let the compiler understand.
Signed-off-by Arnd Bergmann <[email protected]>Reviewed-by Ping-Ke Shih <[email protected]>Reviewed-by Gustavo A. R. Silva <[email protected]>
Patch applied to wireless-next.git, thanks.
47e612268ea0 wifi: rtw89: use flexible array member in rtw89_btc_btf_tlv
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches