mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zijun Hu <zijun.hu@oss.qualcomm.com>
To: Hex Lindqvist <hex@freenixos.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: 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: Tue, 10 Nov 2026 14:40:29 +0800	[thread overview]
Message-ID: <a367cb8c-f2d9-4188-9397-9a46039be14d@oss.qualcomm.com> (raw)
In-Reply-To: <20261109225632.1227242-1-hex@freenixos.com>

On 11/10/2026 6:56 AM, Hex Lindqvist wrote:
> 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.

Hi Luiz, Hex,

Let me give a unified reply here.

I'd prefer to keep it as-is, since:

1) The union maps the memdump layout: for the first segment, a __le32
 dump_size (the total memdump size) follows @subsys, then the data;
 for other segments, the data follows @subsys directly. Hex's
 flattened v2 is wrong for all non-first segments.

2) The current definition builds clean with W=1 and passes
 checkpatch.pl --strict, while changing segdata[0] to segdata[]
 causes build warnings.

3) The struct is the simplest and most straightforward form; it is
 only used to parse memdump frames, so it doesn't have the problem
 DECLARE_FLEX_ARRAY() solves.


      reply	other threads:[~2026-11-10  6:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-08  4:20 Hex Lindqvist
2026-11-08  9:53 ` 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
2026-11-10  6:40         ` Zijun Hu [this message]

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=a367cb8c-f2d9-4188-9397-9a46039be14d@oss.qualcomm.com \
    --to=zijun.hu@oss.qualcomm.com \
    --cc=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 \
    /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 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®