From patchwork Tue Jan 10 01:37:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 41244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2487396wrt; Mon, 9 Jan 2023 17:39:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXu8zUEsFYr8a43Mp6fei6rgnSXBWBYin2eWnUOVjqqIz2euld5nJkbc+HAiRXmYoUREGl1X X-Received: by 2002:a05:6a21:e302:b0:a3:d6:8795 with SMTP id cb2-20020a056a21e30200b000a300d68795mr83167171pzc.17.1673314784229; Mon, 09 Jan 2023 17:39:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673314784; cv=none; d=google.com; s=arc-20160816; b=jyGhnT1RXV9qW4LONbOmTFPG83LaPVkMf6/P1dsSEF3EHSi7GV5yqaVPDo1Xd1Faes m+cuqT1qGXOmCC9WtE791yKW3NkGZ4WthtGCuHInSdnBEATmn9Iz2VAEz+r96LfsgILS thu8dADQl8o1Db0azBFw95MumCJ5sh407yQH+zvhsJpQ4H/bm5QO23i1a1OJIxr6tSvG jX4wHWPAYS9hMGDUw3x7ORkh3pcgxJ92jYtmKC981FK1Lvtwo+AoYOCrfCieGlElhIWp NKZbY1JCc28cK6pCYX0TJHBy1ep5q/qkwCCCLOHvkQPpviLrUDI5LAZIpG1INV+a2DFz RZWw== 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=CH/8QLVdPUrgGTVpTNfaKyKDOWfAArUQ9nwnN7NLF2DRqSmR8DwVbxaCos3c3rdlNt 9IJ/pRcwMA56qQmomShtqDJlikSN80IIimwZy+jyPvcVwB6G4qTrhrY2338zV89psTGp 15C+VbaV2huiVW/a60VHd3YuqOpJKFgzXutInJQ+Aq8uQDFFAkCujTcwYfKwdOaEtVLm Q3h2CGnWLENNxcSNYCjFybZRzDOOQMpCW+wWXnO0RtC0Tc7KeHPIJZtoQQ1TSqmuLwoD jce87YBAdIqjwJMcnGkJX6JajM8vm09EnUH7ib15uLutlqmrzjpYOz+zSHsbWqAUK9bz sk1w== 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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a63e855000000b0047916fa90e6si10889880pgk.873.2023.01.09.17.39.31; Mon, 09 Jan 2023 17:39:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S230039AbjAJBhv (ORCPT + 99 others); Mon, 9 Jan 2023 20:37:51 -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-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-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754597722892806467?= X-GMAIL-MSGID: =?utf-8?q?1754597722892806467?= 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 Reviewed-by: Kees Cook --- 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 {