Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp708344pxb; Wed, 8 Sep 2021 10:24:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdPoEFZfudPMK9iQjZ7QZpfC1Z2DB3FKCZOQ+413vG9uk+VsXbeEBUV9n+gcwyvinPvYAq X-Received: by 2002:aa7:df8d:: with SMTP id b13mr1342655edy.393.1631121883495; Wed, 08 Sep 2021 10:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631121883; cv=none; d=google.com; s=arc-20160816; b=iAmFu9eCHng0iIdYDf+yCt97Mkg9lPNIOTvFzRISclp1c8Rpoc4OLTec992udxspoI 1KMLHeN9EjVeDiPYaRmpAdoFaTQeyhV71RqCONlJsmGkcoICw59v4vZmfEI4tBCaXsEP ZYb3HgzYkOhn27BP1OLln7ZYQGa/IB6gftUKPbPE3rUicoqz/oknJ1/lls8jF0sqIOFl SZT2KfOcYFQoKWa/2jYSyWYsi91jJhKYjwYJ8Hy8TSGdLn897RH6T/vWfeLl/WEh6xrM x+Sk830P4jyZie6WaL+/01mMyNPHyX9icazKJgilj+9Ctwl2KTFTfGh8t/ayOEtfHM1o HnVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KBgIBYhNiuhRoAQwhL4+76fZcU+4oA2Ww+wpi6gpLPE=; b=TvoJ+n7seXNL3UX5POPsRecA87p6LkRHcPLrjOtn+Se22gzUxjnTnK2fOjY5IQfuxY TO8XQc3PbFUHOvSZqi0ojDXjxoZfL4Nma2KZlMuK8Y5YsZ7K5ggW2AZkObuUBpwHbBYn quAeDNdkTW/oDHRZAAjaEwgFaWQnIJS7AErFRi9IFw8fkhzf/HJJAhwMGNKYrU1GHXlh mdbYpDmWPR3K4hFGs0OuhNRwTyDi/ac47VSBmtc5o7lc48i2eNH86ZF6VGzKX5rRpsJX rYnjHvTBtPwIevdN5hT+zDhjZxnVWplI62z4XFIX6Xfm96YSuieR/07fFFgI0rIz8dK/ d/Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DtM87flC; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si2644998edq.258.2021.09.08.10.23.58; Wed, 08 Sep 2021 10:24:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DtM87flC; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230091AbhIHRTm (ORCPT + 99 others); Wed, 8 Sep 2021 13:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbhIHRTm (ORCPT ); Wed, 8 Sep 2021 13:19:42 -0400 Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08292C061575 for ; Wed, 8 Sep 2021 10:18:34 -0700 (PDT) Received: by mail-vs1-xe29.google.com with SMTP id o124so2700426vsc.6 for ; Wed, 08 Sep 2021 10:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KBgIBYhNiuhRoAQwhL4+76fZcU+4oA2Ww+wpi6gpLPE=; b=DtM87flCRRGm4s5aHxj7CBDUPt7/rcN07S+A9o8B4/9O8H/RyASReCIXdIAy8q2a59 8nK+tD8/gWcUa+COio97UYmyJofYCiKgQMZTLpA68KzwIrHAVdFRtGbOsQ+X68/Q2D8F W3tn44Ub550yYR24zSFNPrksWJYw7s5zkl7aAE0grrnFcwJmq/UgKNkRHxoh1R4mnw+r 9Jy2clLegMigApGIp9r31gn4knMNzrzxr+sEw3+5NXvNXEyURyp+Zc1/awV3zbDOh2/x DEzCj9jdjHZrURYwpgOVSV3Ze7qCP2bFY/CHGPwkgXDSYJxY9zD9QQC3B7JwNqVldQDJ 9qkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KBgIBYhNiuhRoAQwhL4+76fZcU+4oA2Ww+wpi6gpLPE=; b=nsrrhW+seSR/7NHR81haYuBBLjOWjvLvawy53EDGzKwzSwJ7RYWdv8DZjmoeTFNM5A OM6675BFaB87HmCOWuwilo/P/gyAI7v+xnxWIzc9sgzjmBxTiOKR5GMGlHMb+2Hq0raZ KBUN1NByN8H/VNk+j82XvM2OSnJ1sSVOJwtA7gWbzdQLrGvzqONQRpnrBzJtEZbq4Y8X HJSRbRoIo+DZbarXvmjYOLqA6rihK9j7kLcS8oiFu/767P3qaTnRG3FrIU3dwL3doBQk waU1kvhsEEJuK9EJZ1rNYsW04XyIQgVWHq2zcAuqR2yiN8zjwbIXFYOeHjdCbD3JJ8p5 r56Q== X-Gm-Message-State: AOAM5330HTpyAbuK/7cOEkRaUmKyL49UktIa9Y1ZkdMyTvoyFAtfQFHB LJlbU6vqF5jZXtR/AnHsp1V9vJjhHzIURPksAporvHda X-Received: by 2002:a05:6102:31a5:: with SMTP id d5mr3460211vsh.23.1631121513082; Wed, 08 Sep 2021 10:18:33 -0700 (PDT) MIME-Version: 1.0 References: <20210831163545.3646157-1-pab@pabigot.com> <3CBFA8E8-ABA1-495F-BFD4-A4E3CBC1E21B@holtmann.org> In-Reply-To: From: Luiz Augusto von Dentz Date: Wed, 8 Sep 2021 10:18:22 -0700 Message-ID: Subject: Re: [BlueZ PATCH] lib: fix variable-length array declarations in hci structures To: "Peter A. Bigot" Cc: Marcel Holtmann , "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Marcel, On Tue, Aug 31, 2021 at 2:54 PM Peter A. Bigot 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 > >> --- > >> > >> 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