All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Peter A. Bigot" <pab@pabigot.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [BlueZ PATCH] lib: fix variable-length array declarations in hci structures
Date: Tue, 31 Aug 2021 14:30:12 -0700	[thread overview]
Message-ID: <c3b21654-8d46-4b12-7d9b-b3eeb12678f9@pabigot.com> (raw)
In-Reply-To: <3CBFA8E8-ABA1-495F-BFD4-A4E3CBC1E21B@holtmann.org>

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

  reply	other threads:[~2021-08-31 21:30 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 [this message]
2021-09-08 17:18     ` Luiz Augusto von Dentz

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=c3b21654-8d46-4b12-7d9b-b3eeb12678f9@pabigot.com \
    --to=pab@pabigot.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /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.