Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp741060rdb; Fri, 2 Feb 2024 02:35:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvogxlgypxnCiuZEvwWtQUPCVoYJGGasGQLSW9MbQexen+akReDoD8Fk92IEgMLh5Z2bfU X-Received: by 2002:a05:6402:339:b0:55f:95f0:2cad with SMTP id q25-20020a056402033900b0055f95f02cadmr774533edw.41.1706870113273; Fri, 02 Feb 2024 02:35:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706870113; cv=pass; d=google.com; s=arc-20160816; b=QSwNVUWhxM7DDC76ndoBr86x4Ul/obfBnOW8kXxfGpcauVr99XeccpNlBITW7Y9Lsn hhvtJY7sQyMUheemp+2pRtgJ28XWGk9jtE9wiNLuVClEWhyeu/UsvCQAhXoN0EmpmtBP Zhofe6zpcysEaAHMk/1ci7wjrFYzt3M/NM9Jd0YEVlT0UAm5Cg33Rt7eigv+E1+5tB3L Bg9cDpIM/GuE9WPkki26WAdp0yEsAOF05Nfr8qzWxpPMAYL4oo8220J/QwoVpR+ffxd4 4eF1Y2TC3bq3352vn420zxAJuJf4SqIZxeOpGKbjcmNp+gHwj2emVoovwbhizKfMyau7 N81w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=uD/sPc7FMJ/uY13jycAiw319CMk1mhe2FbFR5UM4LCo=; fh=ps+hKiFED6qHZeh4VUghK/re4qhRQHnAZrLInYyVoJ4=; b=CCrO9PGby/zogYK+H/dI0rycT5t59jdO5jQK3TSisSjk1WwTb7rdqtENy1RepQZj9u 75wC2L029oHLgSaa+VWfeu/GBzrgw95fAhTHeoosdAHGiLFrT3F3IMywgTLhcgu5596r KUQmkCWFyEgPun+33cRRtKdDAi0Dmk4kgTqlcENtnq+Z/dzOSqdL+edogCoaUtk7XhZL fl+pGZ5L81mD9k56nuFmTqLjYUavX1ZMpE6dQup45+hUiro05hZGtV8KPvcP2vf6aoCi Ke/BMwiji8t4erxh/1Cwocl453ymu9PzuyN1u3Xtp0xoH4bsLE2QowaotOQ43i2SB4Kv BOBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rrx9tZLd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49681-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49681-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUpc7DqgT5CC9JSTfdvZLcEse9+zZ2xO+n2iziYpivVwwkQmKoyHiWwGxGyCO0COPCak9s9qc+3pPuwqTKdbiT25K05DubdGzAKIJcKKw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cw10-20020a056402228a00b005591fde7b64si683987edb.216.2024.02.02.02.35.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 02:35:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49681-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rrx9tZLd; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49681-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49681-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 0AEEE1F2AF0D for ; Fri, 2 Feb 2024 10:35:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A789C13BEBA; Fri, 2 Feb 2024 10:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Rrx9tZLd" 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 B3A4A82896; Fri, 2 Feb 2024 10:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706870101; cv=none; b=RKAbu7cNGbtTaKpZiP0ItLd4KUETUoSJ8f8uId8/sncjuAjWsYPy6/FqyeMHMbJtUU3eL34mTYVlfm+kqnh/OkjtCraXQzDqBDhFit27VeIVTkbb3vbGfoh8WX1sYJl3PCj5qIeAr5hpKbRwo+fivmjj2UmeqTIII3GsTvKq0xs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706870101; c=relaxed/simple; bh=uD/sPc7FMJ/uY13jycAiw319CMk1mhe2FbFR5UM4LCo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=BM3R6+GG9XFfT8yDPv4rBlAdl1qf6z1+FCeKxmzyxKwDIRKupMmHB/5Zb9vL0gVpTAJYzYE2TujwPZxfUwK6VNouO9xn3bF2NHlYrVVTF6MQA+6hP+TnACVh62sD1pxYvHZ2XvZLdZAU66HhHnPPdIjypKgmG/BnkSshv7IhBH0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Rrx9tZLd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E41DC433C7; Fri, 2 Feb 2024 10:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706870101; bh=uD/sPc7FMJ/uY13jycAiw319CMk1mhe2FbFR5UM4LCo=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Rrx9tZLdm0GUAzf3hhCrj99t2K7tE2YFipabCOhmLwfTwbP05vhk0npEfIycZWRQY LDXyp9K5JgESqlVT3Si1xDf0UlR+CePpjDYRZtQmonq5efdbNuyrMe7dvvOpRSIgkF AAu1NVzwj65B+bCxC+Pgf3ahfp96h7ZP4MV1O4iQ1WjhhROuzLY1RzlwYa+SEtHEfy +6EputEp7XjMrfLzfOPCsifhzBNQeyU/3xL9pB++tf0nhs1YWkSSp2luaoUDpPmSk0 GQKUdjXcG8C6/LbXJdaqrs2W53Jl5C2wvDoCz6Q/gATd3c+APGY8keSSAAUWR79m1D bvBJChBiCeB6g== From: Kalle Valo To: Arend Van Spriel Cc: Kees Cook , Franky Lin , Hante Meuleman , Chi-hsien Lin , Ian Lin , Johannes Berg , Wright Feng , Hector Martin , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, "Gustavo A. R. Silva" , Linus Walleij , Jisoo Jang , Hans de Goede , Aloka Dixit , John Keeping , Jeff Johnson , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] wifi: brcmfmac: Adjust n_channels usage for __counted_by References: <20240126223150.work.548-kees@kernel.org> <170678189299.2736043.11616312910656558919.kvalo@kernel.org> Date: Fri, 02 Feb 2024 12:34:54 +0200 In-Reply-To: (Arend Van Spriel's message of "Fri, 2 Feb 2024 11:00:51 +0100") Message-ID: <87v877tar5.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Arend Van Spriel writes: > On 2/2/2024 10:58 AM, Arend Van Spriel wrote: > >> On 2/1/2024 11:04 AM, Kalle Valo wrote: >>> Kees Cook wrote: >>> >>>> After commit e3eac9f32ec0 ("wifi: cfg80211: Annotate struct >>>> cfg80211_scan_request with __counted_by"), the compiler may enforce >>>> dynamic array indexing of req->channels to stay below n_channels. As a >>>> result, n_channels needs to be increased _before_ accessing the newly >>>> added array index. Increment it first, then use "i" for the prior inde= x. >>>> Solves this warning in the coming GCC that has __counted_by support: >>>> >>>> ../drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c: In >>>> function 'brcmf_internal_escan_add_info': >>>> ../drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:3783:46= : warning: operation on 'req-> >>>> n_channels' may be undefined [-Wsequence-point] >>>> =C2=A0 3783 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 req->channels[req->n_channels++] = =3D chan; >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= ~~~~~~~~~~~~~~~^~ >>>> >>>> Fixes: e3eac9f32ec0 ("wifi: cfg80211: Annotate struct >>>> cfg80211_scan_request with __counted_by") >>>> Cc: Arend van Spriel >>>> Cc: Franky Lin >>>> Cc: Hante Meuleman >>>> Cc: Kalle Valo >>>> Cc: Chi-hsien Lin >>>> Cc: Ian Lin >>>> Cc: Johannes Berg >>>> Cc: Wright Feng >>>> Cc: Hector Martin >>>> Cc: linux-wireless@vger.kernel.org >>>> Cc: brcm80211-dev-list.pdl@broadcom.com >>>> Signed-off-by: Kees Cook >>>> Reviewed-by: Hans de Goede >>>> Reviewed-by: Linus Walleij >>>> Reviewed-by: Gustavo A. R. Silva >>> >>> I'm planning to queue this for wireless tree. Arend, ack? >> This slipped past my broadcom email. As the Fixes commit is in 6.7 I >> would say ACK. Thanks. > Cc: to stable? Is commit e3eac9f32ec0 in stable releases? (I don't follow stable and don't know what commits they take.) I propose that as we have Fixes tag let's not add cc but instead let stable maintainers to decide. --=20 https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatc= hes