* [PATCH] Bluetooth: btusb: Use DECLARE_FLEX_ARRAY() for memdump segment data
@ 2026-11-08 4:20 Hex Lindqvist
2026-11-08 9:53 ` Paul Menzel
0 siblings, 1 reply; 2+ messages in thread
From: Hex Lindqvist @ 2026-11-08 4:20 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz
Cc: Zijun Hu, linux-bluetooth, linux-kernel
struct qhci_vse_memdump declares segdata as a zero-length array in a
union. Zero-length arrays are deprecated [1], so use DECLARE_FLEX_ARRAY()
instead.
No functional change: segdata is only used with offsetof(). With debug
info stripped, btusb.o is byte-for-byte identical before and after,
built with GCC 16 and Clang 21 on x86_64 and GCC 16 on arm64, with
UBSAN_BOUNDS and FORTIFY_SOURCE enabled.
An AI assistant helped find and check this change and drafted this
message.
Link: https://docs.kernel.org/process/deprecated.html#zero-length-and-one-element-arrays [1]
Signed-off-by: Hex Lindqvist <hex@freenixos.com>
---
drivers/bluetooth/btusb_qcom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btusb_qcom.c b/drivers/bluetooth/btusb_qcom.c
index cc4cfcde2afa..97be9078e045 100644
--- a/drivers/bluetooth/btusb_qcom.c
+++ b/drivers/bluetooth/btusb_qcom.c
@@ -533,7 +533,7 @@ struct qhci_vse_memdump {
__le16 seqno;
u8 subsys;
union {
- u8 segdata[0];
+ DECLARE_FLEX_ARRAY(u8, segdata);
struct {
__le32 dump_size;
u8 first_segdata[];
base-commit: ebdfe8561b5496b7eafedccd13a000a7261bc52b
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: btusb: Use DECLARE_FLEX_ARRAY() for memdump segment data
2026-11-08 4:20 [PATCH] Bluetooth: btusb: Use DECLARE_FLEX_ARRAY() for memdump segment data Hex Lindqvist
@ 2026-11-08 9:53 ` Paul Menzel
0 siblings, 0 replies; 2+ messages in thread
From: Paul Menzel @ 2026-11-08 9:53 UTC (permalink / raw)
To: Hex Lindqvist
Cc: Marcel Holtmann, Luiz Augusto von Dentz, Zijun Hu,
linux-bluetooth, linux-kernel
Dear Hex,
Thank you for your patch.
Am 08.11.26 um 05:20 schrieb Hex Lindqvist:
> struct qhci_vse_memdump declares segdata as a zero-length array in a
> union. Zero-length arrays are deprecated [1], so use DECLARE_FLEX_ARRAY()
> instead.
>
> No functional change: segdata is only used with offsetof(). With debug
> info stripped, btusb.o is byte-for-byte identical before and after,
> built with GCC 16 and Clang 21 on x86_64 and GCC 16 on arm64, with
> UBSAN_BOUNDS and FORTIFY_SOURCE enabled.
>
> An AI assistant helped find and check this change and drafted this
> message.
>
> Link: https://docs.kernel.org/process/deprecated.html#zero-length-and-one-element-arrays [1]
> Signed-off-by: Hex Lindqvist <hex@freenixos.com>
> ---
> drivers/bluetooth/btusb_qcom.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/btusb_qcom.c b/drivers/bluetooth/btusb_qcom.c
> index cc4cfcde2afa..97be9078e045 100644
> --- a/drivers/bluetooth/btusb_qcom.c
> +++ b/drivers/bluetooth/btusb_qcom.c
> @@ -533,7 +533,7 @@ struct qhci_vse_memdump {
> __le16 seqno;
> u8 subsys;
> union {
> - u8 segdata[0];
> + DECLARE_FLEX_ARRAY(u8, segdata);
> struct {
> __le32 dump_size;
> u8 first_segdata[];
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-08 9:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 4:20 [PATCH] Bluetooth: btusb: Use DECLARE_FLEX_ARRAY() for memdump segment data Hex Lindqvist
2026-11-08 9:53 ` Paul Menzel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®