From: Hex Lindqvist <hex@freenixos.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Zijun Hu <zijun.hu@oss.qualcomm.com>,
Marcel Holtmann <marcel@holtmann.org>,
Paul Menzel <pmenzel@molgen.mpg.de>,
linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: btusb: Use DECLARE_FLEX_ARRAY() for memdump segment data
Date: Mon, 9 Nov 2026 14:56:32 -0800 [thread overview]
Message-ID: <20261109225632.1227242-1-hex@freenixos.com> (raw)
In-Reply-To: <CABBYNZJdeHXP1XjYcTwUdCe_SFfxMETpSQbF7t0FHyxY4YfZQQ@mail.gmail.com>
Hi Luiz, Zijun,
Thank you both for looking at this, and Paul for the review.
On Mon, Nov 9, 2026 at 10:39 AM Luiz Augusto von Dentz wrote:
> On Mon, Nov 9, 2026 at 10:35 AM Luiz Augusto von Dentz wrote:
>> While this maybe true if the above code does produce new warnings then
>> it needs to be fixed anyway, from the commit message it doesn't
>> mention any build warning but that perhaps is because it is enclosed
>> into a union which mask it or something, anyway trainling variable
>> length should be accompany with __counted_by; so the compiler can do
>> bounds checking.
There is no build warning, with or without the union; the patch was
only about the zero-length array being deprecated. __counted_by does
not fit here: the struct has no count field, and the segment length
comes from skb->len.
> Maybe not DECLARE_FLEX_ARRAY, but [0] is not recommended for vla see
> the Link tag, in fact the first_segdata[] does follow it so this needs
> to be fixed anyway.
As Zijun says, segdata is only an offsetof() anchor, so it can go
together with the union:
struct qhci_vse_memdump {
__le16 seqno;
u8 subsys;
__le32 dump_size;
u8 first_segdata[];
} __packed;
#define QHCI_MEMDUMP_HDR_LEN offsetof(struct qhci_vse_memdump, dump_size)
The header is pulled with QHCI_MEMDUMP_HDR_LEN, the first segment's
dump_size with sizeof(md_vse->dump_size), and the kernel-doc gains a
line saying that middle and last segments carry their payload right
after @subsys. The generated code does not change.
Zijun, would that work for you? If so, I will send it as v2.
Thanks,
Hex
next prev parent reply other threads:[~2026-11-09 22:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 4:20 [PATCH] Bluetooth: btusb: Use DECLARE_FLEX_ARRAY() for memdump segment data Hex Lindqvist
2026-11-08 8:47 ` bluez.test.bot
2026-11-08 9:53 ` [PATCH] " Paul Menzel
2026-11-09 13:21 ` Zijun Hu
2026-11-09 15:35 ` Luiz Augusto von Dentz
2026-11-09 15:39 ` Luiz Augusto von Dentz
2026-11-09 22:56 ` Hex Lindqvist [this message]
2026-11-10 6:40 ` Zijun Hu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261109225632.1227242-1-hex@freenixos.com \
--to=hex@freenixos.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=pmenzel@molgen.mpg.de \
--cc=zijun.hu@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.