Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7075031rwl; Mon, 9 Jan 2023 17:40:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXtUwvNRX2UW7KTcfv3jJw74HxrJEaexIRPOVz4DsIrRjTKfCsMyHiRkktfE/AYfIiY0HS9E X-Received: by 2002:a17:902:7fc7:b0:192:6503:1a9a with SMTP id t7-20020a1709027fc700b0019265031a9amr55768425plb.18.1673314820085; Mon, 09 Jan 2023 17:40:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673314820; cv=none; d=google.com; s=arc-20160816; b=huPrPxmKdXprazXRMgSJwQyPMjFNyu2ibIS1Z9lof5JpNobwSInUWeoYi01nnzkjy7 K749HepZbJaItrmRD8PkSJITrzTg3iToA74S2XdC28wXxdK5quHF/I4O3J8P8D9owKan ELf1o0nwWyHSBuziWRNo5XL49FOhwD6nnc9mkePbGvKTkMIIMvttQb3ph1jxe1ciR2NQ WrtLoLCj+Ar3d87aChpOBHp+9Bi15G0Mqk/FX7Xc7X9oDuNMOPBtNIT5Ca0v2zwnTjSJ SR36DOfQZA8gdK/KTjBX40XiONYwqWLbyzF/bAa/vZ5y+TZN/qFc4vvBBEuSas00R+ic ocvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=Jh3pXQFoamNBM74lDJGjEMVngHG0HejwuZLqF7xnjpg=; b=LKF+UG6IUnQ2Q511eJS+kUyr4m2ZerJ0rXoU12Dy42i1Um5Uc1jR5EyAWouKZn9okp XK3DZgaWEV6sK3cwZ2qbYwkdRzrSaqPWYaQYrCrqRvg3rxdLQ9XUM41YcakkKEnEUhTX TW8+/hKmby6bn67jgTpEtPg7ThVgnVz9wsaslEmKoETmzuTDlZq9JRuw5sNF83wcd3QJ OTBkEwCx35MPk2PQv4vLT26EfLKMXaAxZ6FVkcYF0HpExxBOgXn96WP2/rBc5D2rKS84 fAOwUZq6KkLyU/ezk6ztffk6sl6CTph4d1sGQddxJRlpVifqlvGECFv8nvpd4AbKfWob GbPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rGhM1W7K; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m17-20020a170902f21100b001928d1778f8si9432982plc.251.2023.01.09.17.39.52; Mon, 09 Jan 2023 17:40:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rGhM1W7K; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229470AbjAJBhu (ORCPT + 99 others); Mon, 9 Jan 2023 20:37:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbjAJBht (ORCPT ); Mon, 9 Jan 2023 20:37:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94212200A; Mon, 9 Jan 2023 17:37:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 495E8B810C3; Tue, 10 Jan 2023 01:37:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87324C433D2; Tue, 10 Jan 2023 01:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673314666; bh=TVslpPBIR8MuKlhIXlT+VUj5823H7/tO3yYzmKXgFEA=; h=Date:From:To:Cc:Subject:From; b=rGhM1W7KtwevREfbvXh7z3X0wYmbJRJyuefm+/4jWa1Mzg/jfQRCoZWF7NHURVXey rdPfb/Hey4eV1r1tcYjl0Gc2RJOU6YadJ6MuEzzeNUBLUezA/EWbIICvQTeiHA/KIS FGmLwrCJDHLdYsfLL55xeuWOkfyyQNBBjVrAaw5KrhOd9OoKwRvU/ng7JR32Uw6ZRB SQN4UwZwR1b1DYgWeV8SCAv2U8EyKhrPUZLX9CPrfMCZ9c2/SMUaf9IqiORrALavnB 9u540tntexY3G359O4qyhF7KZRlky9dxfFPsmNdvrj6iih7uc9zM5mR6efx8B1+vG4 bRrmd1dDK4lUQ== Date: Mon, 9 Jan 2023 19:37:52 -0600 From: "Gustavo A. R. Silva" To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] Bluetooth: HCI: Replace zero-length arrays with flexible-array members Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Zero-length arrays are deprecated[1] and we are moving towards adopting C99 flexible-array members instead. So, replace zero-length arrays in a couple of structures with flex-array members. This helps with the ongoing efforts to tighten the FORTIFY_SOURCE routines on memcpy() and help us make progress towards globally enabling -fstrict-flex-arrays=3 [2]. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1] Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2] Link: https://github.com/KSPP/linux/issues/78 Signed-off-by: Gustavo A. R. Silva --- include/net/bluetooth/hci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 8d773b042c85..400f8a7d0c3f 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -2156,7 +2156,7 @@ struct hci_cp_le_big_create_sync { __u8 mse; __le16 timeout; __u8 num_bis; - __u8 bis[0]; + __u8 bis[]; } __packed; #define HCI_OP_LE_BIG_TERM_SYNC 0x206c @@ -2174,7 +2174,7 @@ struct hci_cp_le_setup_iso_path { __le16 codec_vid; __u8 delay[3]; __u8 codec_cfg_len; - __u8 codec_cfg[0]; + __u8 codec_cfg[]; } __packed; struct hci_rp_le_setup_iso_path { -- 2.34.1