Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1885454rdb; Sat, 2 Dec 2023 13:28:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcKoYCB4vYqYzSBrnOdGv1IDa24WBryWcpx6HLcsUdI5uxXs14YfE1e8DaL8Mo2vtw424M X-Received: by 2002:a17:906:2259:b0:a19:a19a:eac4 with SMTP id 25-20020a170906225900b00a19a19aeac4mr2331181ejr.125.1701552484978; Sat, 02 Dec 2023 13:28:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701552484; cv=none; d=google.com; s=arc-20160816; b=FbT6s5VoEj8XIYmuzc646upmoKP4E+v9Won8kDpt3wxfzH7292hgdsiETyC9rMi+Oa lxcMsol2KO398Zgj0Klwrp1pbBk9u5P56XA3Qd3uG7BprYBtxOD3u9LcaC8VAHdZW6zK jPSkXEd3jl/pZY4m/aLMAXv7qUoD4Cu+/lqBI4ENcDMnzjgPvci56HM1eVqu7XKqjPtG rQc4Saw1LYrXPMXww8W4O7ZcDTWS04lopfalM06RMtAt+JDZHcZA6HUakUazjaaAi1Y4 Sus2060eWuWE65mipPKvfC0wv4h/aZG7V2vJ6W8qHvOZw69+jeK7hpKNFQae+dXq9u9R Opig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HHEDt6VQ8LzeSpO7og1P0K/YDfArH7UZrlszyK0VJhs=; fh=2F3FrywSoSQRAC96f1M6ttRHFSKcQ2tixBUM8tBssc8=; b=ea6AZg2mx6fCC170OPRZtMG6JRwL/0NtZqrEZj2pZfBOPJjc3LC4B5frs3H5nCkxGb kfsTMqjRG1shIZF/VC32jkf2LlEIygSTKW8ADfb3EZ5uIM+GG/WbwqOKjF9yyW8LXYA6 NyOtEggCXR+BAGUV2EuvFtijJlwmt2Ryfb0CWokwThoVWcBmM59w8y0+/WtQvGPuKEMH RtdjGJ6zy9yNew07lx24jBAQ440eKKc/8+jN48Xu2BXWHev/IZhpr7X/2C72LLK/tuzs 2Ot3qjwdRNrTjsYL2JrHHyDpzOyxXUqocipKbb8OeaQ0j+RfM0QMP5TKMm0NN1IpMQBh RAtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A0njk1uE; spf=pass (google.com: domain of linux-wireless+bounces-334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-334-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id kk1-20020a170907766100b00a0fe0ed5d38si2927344ejc.444.2023.12.02.13.28.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 13:28:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=A0njk1uE; spf=pass (google.com: domain of linux-wireless+bounces-334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-334-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8EFB21F20F68 for ; Sat, 2 Dec 2023 21:28:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 360112136E; Sat, 2 Dec 2023 21:28:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="A0njk1uE" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D83E102 for ; Sat, 2 Dec 2023 13:27:56 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2867ace9967so458272a91.1 for ; Sat, 02 Dec 2023 13:27:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701552475; x=1702157275; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HHEDt6VQ8LzeSpO7og1P0K/YDfArH7UZrlszyK0VJhs=; b=A0njk1uEzGdzfnskQb3vd7n5zV+OMsAAU/SYawClffVNIyX9gTme3Siqve1BeDAWGD XQRZBRiF4zHaGlySDgqNsCAuV1BeKhiVqzMZvmn7xOYJuLS+EY+ctFOcrRZV7CDaen1H CXcBtPkiyA7tK1iVhlFDSvOe1rxyuTxnxWcRM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701552475; x=1702157275; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HHEDt6VQ8LzeSpO7og1P0K/YDfArH7UZrlszyK0VJhs=; b=MlopT1N6oMIZr5/dCc2LQoby5sWzucx5KTQrqC+3KVcDafSSA/HxaVbS2TqvhSxzPL FDbgONjkI77OPvjHrFclSzetjGDihl2Z1m07s8EOQ6Hzfnzi3vzw67imvy6IO1gFa6od ugN9TS2hBxKly9vsSBEcCTlQ7PsJMiTZNQ5dOWxUZ36WysGCFiJUTmGcq8jwREuyHb9K /Thza3LyW6cX03SLc88IiaLnEcJZt9xP9S8j/8FuRcZobrAkYFJrBRyp3YphIdmHnpL3 Atuxua2gB5hoXjGRV8+Elx9o//seFU04NpgTBMJvhIPhQ3xtXqXY3tmiA9/vBKLzKRti yoJw== X-Gm-Message-State: AOJu0YwNPd0Zln+AvgV1leo/8dLTkx9sGnMWejlCX53QTPrOJJXbQhqi ZjulqxGc0AOvsTaBz+PZVUksHg== X-Received: by 2002:a17:902:bd05:b0:1d0:6ffd:e2e3 with SMTP id p5-20020a170902bd0500b001d06ffde2e3mr1629422pls.125.1701552475636; Sat, 02 Dec 2023 13:27:55 -0800 (PST) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id i9-20020a170902c94900b001cffe1e7374sm5608964pla.214.2023.12.02.13.27.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 13:27:54 -0800 (PST) Date: Sat, 2 Dec 2023 13:27:54 -0800 From: Kees Cook To: Kalle Valo Cc: "Gustavo A. R. Silva" , Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH][next] wifi: mt76: mt7996: Use DECLARE_FLEX_ARRAY() and fix -Warray-bounds warnings Message-ID: <202312021326.D3504C1@keescook> References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Nov 16, 2023 at 02:57:24PM -0600, Gustavo A. R. Silva wrote: > 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 *thread ping* Can wireless folks please pick this patch up? -Kees > --- > 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 > -- Kees Cook