Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp95801rdb; Thu, 16 Nov 2023 12:57:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3Vxlgj4DuoTshrr0eQ98zLbiIGk/P4KMj/RlW9sohGrRQwd0btk83T++uAwsQpbIzbgX+ X-Received: by 2002:a05:6808:6c3:b0:3ae:2877:9b31 with SMTP id m3-20020a05680806c300b003ae28779b31mr18139794oih.20.1700168261382; Thu, 16 Nov 2023 12:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700168261; cv=none; d=google.com; s=arc-20160816; b=zTw4UZGwe0glMSOEsDrdP8/m4b0F7zW/r3t57RuZxNk8aXEtvvyU8rJJHOhObxfEjV y7hngX/dQtque3JvfWflNeNcdU/l9+wDa1Do0KPoShCW7NKL2kx7fJDdS1uqzkhR5A/M PubL8L73mnNdsv2KB5js8vnz5IP5xfM2vsjul0WYwDA4H4HLo0TKRggIwcS5f9U5NvHm 27i6cHl8JrZUN0/CGpngdyw8Qxd7TvzgW8M6swH8bIG+0UrkMQH4se4t2krKao2ssW6S x47vmySOzIfWJ7+agcExdFDdz6BM9XemUkAKRWaj5e+5IIe1hlVP8VrUmbsNom5h852Z lWVg== 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=qpSxMQD02TbsUjTC1Qh5tk5c3aZ2Y6bmVsRYWu1ctPE=; fh=7fJJzRs3oTDjU7TQgWN/mreKhtkabzaQXCCLPhdjZws=; b=D6FINfTmJHP/t+NgGSxvsnA17sDGSOKQiAn3l+kGrMJ6wPuvOUt1zdoqabBu9bDJ8L iC10bORP8BUH4oa6zuUBj2RQ7pAo8rcWUU2tCnjM+WAPUQTqE9LfXCucrU4SiCYGd68U W5ASuZL/UgaS5CF9jRZABO232ksfjPUH2StiM2HbL8BxeYHJrrUz6E54dJHAvQFJIDuJ 9OJy4HSPQS4GZkI1AZsKfREY+uIt2XWB3yZCUuBvFCaiocDJ3kQ4s0FfRqEVQXE3QjzX O3jbcAc3DsJ+DpksawKEKJbQBrtViZctoz+3cxyqSWoGEJJZF5TcDCf+RrfpJHxDkD2z K/5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PMUVa2AI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 24-20020a630b18000000b005b93064798bsi240229pgl.191.2023.11.16.12.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 12:57:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PMUVa2AI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 29781801CDAB; Thu, 16 Nov 2023 12:57:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229544AbjKPU5c (ORCPT + 53 others); Thu, 16 Nov 2023 15:57:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjKPU5b (ORCPT ); Thu, 16 Nov 2023 15:57:31 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0ADDD4A; Thu, 16 Nov 2023 12:57:28 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECB93C433C7; Thu, 16 Nov 2023 20:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700168248; bh=EjMKx5nsjR7WnKWGm9tsxjc3r1t11YJJEx0o24R8FgU=; h=Date:From:To:Cc:Subject:From; b=PMUVa2AIRiGi8EJ9pjFjU+974IoHgg3yEfJ31Q9eTjA5HYvoe/4QP4QL2J9Tenblg 5FJZRhqYP3RWZ47tL7qcdk86sP+MG/N68JJSpgBITaZCaL4u2XJD3hoyQ8OmoUFH3V PfBT1Z4KSpHLm75VCOe7WRYrDcFtVAimRoIy3l7MqTJR+ZygB6jkZl3egpJ0iD1O2M LIGs67TT1sWFvI9fzCfybzPrXyytxkGjPQnYIO0qiXtkBNS5Uo3FfSIBSWoig8xcJ9 wWRMUUL/LbjCZS/zA53qqnm+OsCno8mT/vBa1PQu13Q+yLWPTMzAp+izmKxXO9XRfO zmU8iEHtVjnxw== Date: Thu, 16 Nov 2023 14:57:24 -0600 From: "Gustavo A. R. Silva" To: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] wifi: mt76: mt7996: Use DECLARE_FLEX_ARRAY() and fix -Warray-bounds warnings Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 16 Nov 2023 12:57:31 -0800 (PST) Transform zero-length arrays `adm_stat` and `msdu_cnt` into proper flexible-array members in anonymous union in `struct mt7996_mcu_all_sta_info_event` via the DECLARE_FLEX_ARRAY() helper; and fix multiple -Warray-bounds warnings: drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:483:61: warning: array subscript is outside array bounds of 'struct [0]' [-Warray-bounds=] drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:490:58: warning: array subscript is outside array bounds of 'struct [0]' [-Warray-bounds=] drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:492:58: warning: array subscript is outside array bounds of 'struct [0]' [-Warray-bounds=] drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:469:61: warning: array subscript is outside array bounds of 'struct [0]' [-Warray-bounds=] drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:477:66: warning: array subscript is outside array bounds of 'struct [0]' [-Warray-bounds=] drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:479:66: warning: array subscript is outside array bounds of 'struct [0]' [-Warray-bounds=] This results in no differences in binary output, helps with the ongoing efforts to globally enable -Warray-bounds. Signed-off-by: Gustavo A. R. Silva --- drivers/net/wireless/mediatek/mt76/mt7996/mcu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.h index a88f6af323da..9f516f796d63 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.h @@ -163,19 +163,19 @@ struct mt7996_mcu_all_sta_info_event { u8 rsv3[2]; union { - struct { + DECLARE_FLEX_ARRAY(struct { __le16 wlan_idx; u8 rsv[2]; __le32 tx_bytes[IEEE80211_NUM_ACS]; __le32 rx_bytes[IEEE80211_NUM_ACS]; - } adm_stat[0]; + }, adm_stat); - struct { + DECLARE_FLEX_ARRAY(struct { __le16 wlan_idx; u8 rsv[2]; __le32 tx_msdu_cnt; __le32 rx_msdu_cnt; - } msdu_cnt[0]; + }, msdu_cnt); }; } __packed; -- 2.34.1