All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: "Peter A. Bigot" <pab@pabigot.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>
Subject: Re: [BlueZ PATCH] lib: fix variable-length array declarations in hci structures
Date: Wed, 8 Sep 2021 10:18:22 -0700	[thread overview]
Message-ID: <CABBYNZJLU9nDMcpkZ4uZ+dspRRrHjBYH3jYf2LWKO-77G1m=aA@mail.gmail.com> (raw)
In-Reply-To: <c3b21654-8d46-4b12-7d9b-b3eeb12678f9@pabigot.com>

Hi Marcel,

On Tue, Aug 31, 2021 at 2:54 PM Peter A. Bigot <pab@pabigot.com> wrote:
>
> On 8/31/21 2:23 PM, Marcel Holtmann wrote:
> > Hi Peter,
> >
> >> Use of zero as the size for arrays as the last element of a structure
> >> is a GNU C extension, which as of GCC 10 produces diagnostics when
> >> values in the extended array are referenced.  Switch to the C99
> >> standard idiom for flexible array members, already in use in a few
> >> other headers.
> >>
> >> Signed-off-by: Peter A. Bigot <pab@pabigot.com>
> >> ---
> >>
> >> No changes from previous submission except the BlueZ subject prefix
> >> that I hope will get this into bluez.
> >>
> >> lib/hci.h | 16 ++++++++--------
> >> 1 file changed, 8 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/lib/hci.h b/lib/hci.h
> >> index 3382b87bf..a61568bce 100644
> >> --- a/lib/hci.h
> >> +++ b/lib/hci.h
> >> @@ -729,7 +729,7 @@ typedef struct {
> >> typedef struct {
> >>      uint8_t         flt_type;
> >>      uint8_t         cond_type;
> >> -    uint8_t         condition[0];
> >> +    uint8_t         condition[];
> >> } __attribute__ ((packed)) set_event_flt_cp;
> >> #define SET_EVENT_FLT_CP_SIZE 2
> > does this break any API assumptions? Since as long as libbluetooth exists these headers are API.
>
> The size of the structure remains the same; there should be no API
> changes.  I've done this sort of change multiple times over the years
> and nobody's reported any problems.
>
> Peter

Looks like we also use [] in the kernel so I think it should be safe
to do this change on userspace as well.

-- 
Luiz Augusto von Dentz

      reply	other threads:[~2021-09-08 17:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31 16:35 [BlueZ PATCH] lib: fix variable-length array declarations in hci structures Peter A. Bigot
2021-08-31 16:51 ` [BlueZ] " bluez.test.bot
2021-08-31 21:23 ` [BlueZ PATCH] " Marcel Holtmann
2021-08-31 21:30   ` Peter A. Bigot
2021-09-08 17:18     ` Luiz Augusto von Dentz [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='CABBYNZJLU9nDMcpkZ4uZ+dspRRrHjBYH3jYf2LWKO-77G1m=aA@mail.gmail.com' \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=pab@pabigot.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.