tw89: core.h: Replace zero-length array with flexible-array member
Subsystems (3)
PATCH 1/1 tw89: core.h: Replace zero-length array with flexible-array member
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays
--- drivers/net/wireless/realtek/rtw89/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.h +1 -1
@@ -2847,7 +2847,7 @@ struct rtw89_dev {int napi_budget_countdown;/* HCI related data, keep last */ -u8 priv[0 ]__aligned(sizeof(void *)) ; +u8 priv[]__aligned(sizeof(void *)) ; }; static inline int rtw89_hci_tx_write(struct rtw89_dev *rtwdev,
Signature · 1 line
2.27.0
Quoted 11 lines · Gustavo A. R. Silva
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays
Signature · 1 line
Kees Cook
Quoted 17 lines
-----Original Message-----
From: Kees Cook <[email protected]>
Sent: Thursday, February 17, 2022 4:36 AM
To: Gustavo A. R. Silva <[email protected]>
Cc: Pkshih <[email protected]>; Kalle Valo <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH][next] tw89:core.h: Replace zero-length array with flexible-array memberQuoted 6 lines · Gustavo A. R. Silva
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
Quoted 7 lines
Quoted 5 lines
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arraysReviewed-by Kees Cook <[email protected]>
--
Ping-Ke
Jakub Kicinski
maintainerQuoted 11 lines · On Wed, 16 Feb 2022 13:50:47 -0600 Gustavo A. R. Silva wrote:
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays
The subject is off.
Quoted 7 lines · Jakub Kicinski
Quoted 6 lines · On Wed, 16 Feb 2022 13:50:47 -0600 Gustavo A. R. Silva wrote:
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
Quoted 8 lines
Quoted 6 lines
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2]
https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arraysThe subject is off.
I can fix that during commit.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [next] rtw89: core.h: Replace zero-length array with flexible-array member
In reply to Gustavo A. R. SilvaQuoted 6 lines · Gustavo A. R. Silva
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
Quoted 7 lines
[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arraysSigned-off-by Gustavo A. R. Silva <[email protected]>Reviewed-by Kees Cook <[email protected]>Acked-by Ping-Ke Shih <[email protected]>
Patch applied to wireless-next.git, thanks.
2e2f63a19b0a rtw89: core.h: Replace zero-length array with flexible-array member
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/20220216195047.GA904198@embeddedor/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches