Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp999799rdb; Fri, 2 Feb 2024 10:10:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPnWWUqZhH3KU32z+bjyiaxJTEafzF6SeI8dI1EaWrFwmjUHSjqePkwMwOwkfQDUS01Kjh X-Received: by 2002:a17:902:e882:b0:1d9:7095:7e1f with SMTP id w2-20020a170902e88200b001d970957e1fmr3378011plg.67.1706897415399; Fri, 02 Feb 2024 10:10:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706897415; cv=pass; d=google.com; s=arc-20160816; b=d6pHE5FL4rc7vPWHVf32d2n3iF9Ula+kMLv4RbmpjEfQvCOz7ApaiFm+QsXkarSYsX wd/aNngheh+PHe6tG2WtTJ0nzaQ8vepPrhNdC79Y3VtMm5hm8DBxrv3akuh0lqVn27HN JvLtQnqbXaZWBElKED67oO24/yg1fO0dAUTwpa7fCX76jFTDEdTBYf3ov/FA5fitvP6x ieQS3M8GYS7KsbApgQ78ehrn0jjRCCgzF56VLPXn9g1W81Q5nmVIcYqfMZTfUE1wvAKr YV7LyA6JNt8oZT4Aadu9Pvgql4w8wxt5xamrGImj3yeACFCEJ+eHUZNAJoBOE78LAz9a f+ow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=G6k6f7aElP7VLNFd5TSd36D2rwgbRDtNHJQ2BO+8c1Y=; fh=p6hMiD3ip+WBn5GZW3r0Ggk5YGI30iFgjYCi9oErNpQ=; b=l3hYYReXbYIws5x1zct571Q3wnMN8DELkMx1VeTYEgXbTmX7qeGHhUTv2Zm/2FFkLm 1UmoaNm2WI6jFaiK6ukDygZIPwmkxqBj3OWMNO0+BZIDqeq1WE9o1EgNLxIUK2OvyZau pB/2/sIqiE2B8ee+xv/dActMdzvxxbQ7bD6ZgKn5gmyU0tR/QwHRSKRQg+ATni+0vU/s tdlm2INq0uRN62XtacJpKftgLx1/P1ByIwszMunoAVPZeUwEX8AhI/sisqD5DasGqV2E dQW5wUK4Huxzgu4HJL5EkGw5pXk9g7AKcziZuISHMIrhqtAnnh6V6KK8B7YzaD0XE66S dlTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HuvLGtRz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-3048-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3048-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com X-Forwarded-Encrypted: i=1; AJvYcCW9L59f1RivpxKCMudKsWrmHHJIf9cZghX2Gx75T0WKXkQM+y21geVuTvUcDdFs1SC1XiD99MvdK8TksfglpqELsoFEhG46pT7wdZdfkw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x8-20020a170902a38800b001d8ff334318si2098145pla.176.2024.02.02.10.10.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 10:10:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3048-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HuvLGtRz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-3048-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3048-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 554EB28FAF0 for ; Fri, 2 Feb 2024 18:08:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49D4114C58B; Fri, 2 Feb 2024 18:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HuvLGtRz" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F51D149012; Fri, 2 Feb 2024 18:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706897332; cv=none; b=XpsdlpCBXMGkP/bdybTwscIKZ/uJHK5LGz0FsQEA3SZh2q/4SLxR0qmVjzOOzYBaYxYRHh0XH2dEcSKzAW9ru5kVqOw8UNxUyaes2rC23lZpBCcfpChcF2t7U1QwkaYz3NfRtMX94gwPlzWnO7zbW4Id27I4VNXTXglbtjlM5Uc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706897332; c=relaxed/simple; bh=QDFPSRUTTIxcUcZpwGxYxehEIqReHy4CI55yrtFRzQE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=R3VSnzauB7+EajVq0rr25Pi3rnV0e+UPegQy3A4yQXcxOXmnWz5NTrV3zJZ9pW/VppYR7aQVeciOpyAPOMcMmuC+QP+2BHyZPzqp4Rg3Vgp0rYCneL0QTumDUzOybC8gauXNDUMkogE4FU/w4Ud7MwYUGgD7h7XTWvbyRGi1zCo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HuvLGtRz; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a271a28aeb4so353527966b.2; Fri, 02 Feb 2024 10:08:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706897328; x=1707502128; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=G6k6f7aElP7VLNFd5TSd36D2rwgbRDtNHJQ2BO+8c1Y=; b=HuvLGtRz2w13j6OTHfutKvCWVC89LjFa//WG2hynen1EMN20yhwGv3peUtPUbkT50l T6CiQyiIug2foCBsJ+MY0ltfGErFc+smI9f3ysjJhWdDFOGolKNY7PHZ4N/KOCDB4cBf MGYORdta0vVwauk8qFMUF0sZavFmrPg4/RLfOznmfZ22bGBmlZvSTfevLOJy+B5+wBTz klBwecwWXB8cgCxfudmK7RrkA+jgfpn2/jqKVFCahI9DUDD6efQu7Ugreyifdz34dWtR UG5S+WxrW+A+9j+un6/DGXjPZF27FNUD/atw+nihnCjvllzOcH2mVL372EXUnEWUD4pV SQSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706897328; x=1707502128; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G6k6f7aElP7VLNFd5TSd36D2rwgbRDtNHJQ2BO+8c1Y=; b=OEemnNF+NJ/qheUXgedPrZgqhstrmChWWFhg5pcedIEgYtd8ye3On+/CpjXKbi1Nph EinFJ2nWcR4HeGHdg/3ZxniDEt8cuRmAGGgqE1nHxf2htZG5XgOPAKSviZBHugtx783Y 3933tDRVW2vkVudCpJ4RP3dkmRavlBVRbbvFrsZV1/dQKElx5im0ssCExEGXRrBHFSOg 1HzP1JLKhpUPjHFalf/hFKh6EbIFlXcOhAR8U4g46rdvEj1AEreXhBnAdXuLcnSI2oJS INyLu4/bpSpqNAwCUioemQfTsO/djFcgYp+fF+Wl+WKG9PfwvRKmigxRAYPP9dFsRV2j Yfrw== X-Gm-Message-State: AOJu0YxFGr1ewcw7r9TsQq6gO0FluTxybMiGbOKF6OQw4LrUJ1AmkoYS 2nV99muVWJ6CzrCqi0koW9ExRwH9M0exngNZBRMR9JzzeMFiakqjSkNX6CLlFfsTNSJ5 X-Received: by 2002:a17:906:258f:b0:a32:b376:489d with SMTP id m15-20020a170906258f00b00a32b376489dmr1963359ejb.21.1706897328170; Fri, 02 Feb 2024 10:08:48 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWaLAI5Nm8BH0Rzod9H0hrG29E6FsNst7vpQBztE5rDa7BDm5XUmBrBZkyo2NbtACO/IHlAEk+ux5b/aQbm4FAr7+0lhnTwpNBZKDnyMNtHoFsaIvpWKIKaWm2dYks6ALOm4xyzEf1dCDnc9ebWSqSgmYOvtHtUlaxx8u3PXfWIjyWvXBUYtyPV/zLueKhLjNh4cAcop+fOkRd3b1Fc/cLqDU5URos9FMlOAkg4LHGYqUXXdnUBPmapHoP9PpU6CtEUDL1J3urfx+DMcJ5Vrb3fXWJREZdZAEdqKy6zI0/UZbOTn/JZ8ikQtR7Ly5elOdDCpPZ8F1NENw8ZLpaE7IyQJeLaJh1sc0VQPgCAESf93ffOZ/psBKylSNSO+luIsNJZxKKSVwSi4Newey4i9+m2aWGkj43hu6Yo+pXv+xb5J05cE3stMOaeGDowt30OdvnM98Ivvav+Jfp1OqjRT6jdwIgzJ/KgUvMRl0Oqu0SQva1FOmAZem6QT/hfoCON2Zrp2DlrgSgwwbk30GLR7qGl9PJBPsuEt5AZDhswGFmQTVz58M26Q7mbCh30NOrcuoO87evxmmRBNR1Q+HfpT2X5N0OMDVrKl1ITZ3LCCQ8BIz3wuf4HI1uYBTpfo4BstwRsohafUJsk4p5fhIGz7psagTZ9BaeEt98jzloTRZrGcigGdoy1 Received: from [192.168.178.138] (f215227.upc-f.chello.nl. [80.56.215.227]) by smtp.gmail.com with ESMTPSA id g21-20020a170906595500b00a3109a492d4sm1093613ejr.20.2024.02.02.10.08.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Feb 2024 10:08:47 -0800 (PST) Message-ID: <6f92d882-f0c3-4345-878a-bc09b2f24fae@gmail.com> Date: Fri, 2 Feb 2024 19:08:46 +0100 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] wifi: brcmfmac: Adjust n_channels usage for __counted_by Content-Language: en-US To: Kalle Valo 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 References: <20240126223150.work.548-kees@kernel.org> <170678189299.2736043.11616312910656558919.kvalo@kernel.org> <87v877tar5.fsf@kernel.org> From: Arend Van Spriel In-Reply-To: <87v877tar5.fsf@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/2/2024 11:34 AM, Kalle Valo wrote: > 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 index. >>>>> 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] >>>>>   3783 |                 req->channels[req->n_channels++] = chan; >>>>>        |                               ~~~~~~~~~~~~~~~^~ >>>>> >>>>> 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. I confirmed the commit was in 6.7 and the latest released kernel is always handled by stable kernel team. kernel.org main page always shows the active stable/longterm releases. That said I have no problem with your proposal. Gr. AvS