Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4703631rdb; Tue, 12 Dec 2023 07:11:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdfr6u54wKBEV4IWNMpTdkQtmX3kYHYelooKoJjKm1ox15bClQFsDWRx8VmpkFs4mesjoL X-Received: by 2002:a17:906:738d:b0:a19:a19b:426f with SMTP id f13-20020a170906738d00b00a19a19b426fmr1803318ejl.218.1702393875976; Tue, 12 Dec 2023 07:11:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702393875; cv=none; d=google.com; s=arc-20160816; b=DpuQAuKtyMEGioanOOW5mww5zhDYfK8089pmQFXej+eZE3if5vvgUBDXMUDS1fxqJL H28ZV9VNsKtlMjqnWe7gQLMyJkr/3Qbyr55KOcwClrzFxLyGyEyTaOxKI/jGia1Ot7mx HQrWeqhk1ZtDxSx/9HC+NPHlPP5pJ6HEZCcAq+LzYWBwYCHT6wTmja6XeA3Xr1AhgqXU uE4qTcD54epLOqZfrZ+uy88r3NJmPkOT2P3LvyZwc6VKhJ/sOwcu9+tohjybiYR9+CZP D27vejADBYvsn6emdxfTrvgVkAugc1uggy4s5zsA/JMOdgg4/AznZOvYxuQkf2vzDLW/ ZzRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:message-id:user-agent:cc:to:references:in-reply-to:from :subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=nBD6XvChqUL0TMmoKPAu+t3RafdkdadYIHIgmHHll3M=; fh=Ojww7EQTTGy3jOXTQAkfsMKXyXuyUh/m9Y9Q3mC/yKc=; b=ND9cRvoKHmVAIJnHI76eBbXnVbC5i/MaxwuvVFL/lJHG6vAmDcm8i81DI3bvAR6Q9h USrd56qlEt6F8RvR+qIMdNfhTCPR3W53YhLEB4KrQ4oYNTpr42n9WQDC/k/i8/S+pq1d fWRAdVLdAHp7/nLCrmhaaC30Ugo9+dHEdaruQunl/CrdTL1v9ZLH98x7BSVhT2qVRd1D 0hnYSWMLAuC0hzwqZkifMzOlHmX13fBzMi0yNrdJ4ETJCXa5fxxU6NoEMmiHwvdU80Fh RS4FkzzJ/dHnWQzPMH8i+W6cWEFpFD6XUZUylHeWg7VGwO9S8gL2X+wpD9i8Jt0AFLc6 46NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q2bntngs; spf=pass (google.com: domain of linux-wireless+bounces-700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-700-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 i26-20020a1709064eda00b00a1b7f3cb53fsi4695549ejv.899.2023.12.12.07.11.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 07:11:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-700-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=@kernel.org header.s=k20201202 header.b=q2bntngs; spf=pass (google.com: domain of linux-wireless+bounces-700-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-700-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 B4FF51F215E7 for ; Tue, 12 Dec 2023 15:11:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1006075409; Tue, 12 Dec 2023 15:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q2bntngs" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7012745E5 for ; Tue, 12 Dec 2023 15:11:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7E2DC433C9; Tue, 12 Dec 2023 15:11:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702393873; bh=QPR/krVHmjoQ5/V+yZQzkxTpdJRIO/LwVtq9frP3VZk=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=q2bntngsIpTggy2/06KzhMJGxAejpTAkBOzkHxt92ddFX9KqK+cjbpZjxvBdNQioF Bc5MQ8wLVo/B2sVu+8PtESSh17k0Q45m+tg2xLvEoIqu3h7hgrkZhEMvA4+aTTj7HM +yYHrcLa5BgyjuJz8ngjQx7ntFQi86YzOIAkTBoqvDZhb5gCilxc/VPobUMPFDHu9F ZwpgiFK/89oePtMXbrptqcssQO2IYiotE5C9awly8FmBZX75ZgjxudAiNXdoZuMVHq CLz6ps7n02aCCKmN9bE6r2MQJjv1DfqGVIETccp0Eh6A0sGcMriwSmQBg5BeZIN8Ue F4UCAmQUlsZ5A== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: wifi: rtw89: avoid stringop-overflow warning From: Kalle Valo In-Reply-To: <20231204073020.1105416-1-arnd@kernel.org> References: <20231204073020.1105416-1-arnd@kernel.org> To: Arnd Bergmann Cc: Ping-Ke Shih , "Gustavo A. R. Silva" , Arnd Bergmann , Ching-Te Ku , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <170239387004.306086.15470071247075562655.kvalo@kernel.org> Date: Tue, 12 Dec 2023 15:11:11 +0000 (UTC) Arnd Bergmann wrote: > From: Arnd Bergmann > > After -Wstringop-overflow got enabled, the rtw89 driver produced > two odd warnings with gcc-13: > > drivers/net/wireless/realtek/rtw89/coex.c: In function 'rtw89_btc_ntfy_scan_start': > drivers/net/wireless/realtek/rtw89/coex.c:5362:50: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] > 5362 | wl->dbcc_info.scan_band[phy_idx] = band; > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ > In file included from drivers/net/wireless/realtek/rtw89/coex.h:8, > from drivers/net/wireless/realtek/rtw89/coex.c:5: > drivers/net/wireless/realtek/rtw89/core.h:1441:12: note: at offset [64, 255] into destination object 'scan_band' of size 2 > 1441 | u8 scan_band[RTW89_PHY_MAX]; /* scan band in each phy */ > | ^~~~~~~~~ > drivers/net/wireless/realtek/rtw89/coex.c: In function 'rtw89_btc_ntfy_switch_band': > drivers/net/wireless/realtek/rtw89/coex.c:5406:50: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] > 5406 | wl->dbcc_info.scan_band[phy_idx] = band; > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ > drivers/net/wireless/realtek/rtw89/core.h:1441:12: note: at offset [64, 255] into destination object 'scan_band' of size 2 > 1441 | u8 scan_band[RTW89_PHY_MAX]; /* scan band in each phy */ > | ^~~~~~~~~ > > I don't know what happened here, but adding an explicit range check > shuts up the output. > > Signed-off-by: Arnd Bergmann Patch applied to wireless-next.git, thanks. 595b1280e2c9 wifi: rtw89: avoid stringop-overflow warning -- https://patchwork.kernel.org/project/linux-wireless/patch/20231204073020.1105416-1-arnd@kernel.org/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches