From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796413095; b=0PlSiHxUF1NeKchROK0GFKH+8ycGjFyq6NA73Geu5c2xQVV4N2KHOyRBY43ps/AhoKR1 KtU30oZijCHcIfe8arL4DjkcjrR4AFiSisfhUp+yOSZ/JfXr1xpmu/eLD+95gOQ2S3KWP a8GJ8PLHAcuyFbdUhVck/BmqObFIS8jqklWkrchongQl1Ju3SdvYdP9LnDOHy8nvD2uvC mktBVo4hC6br6eyGbe/6K2ArANMFfsH5JUgTm61YO7gY+gmL7KKQV+IBh10Z8Srvf5Zh7 h1vayK+VvGSKHPL2ZQXoOvUBhk9asfCjOGbq2qazqFOoGR66SM7lhK3npFApFnBJGyQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796413095; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:Message-ID:Subject:From:To:Cc:Content-Type; bh=OOX0KKXnEd5i6gOeEnOeIrpGhn1IrMdmC2gcu8tKbcE=; b=ejxGDFiSBvtpraJXKuK3UGb046/43mlpBPakq6OYyIVtZv87GrUMoohO1Y40lJ4R1EMO lf1q9Db8ym5FrsY1s2zysyCknvX82uJXiXEn7Ld1xCCIpwZWW6WbvyhN+PI1ApD9QUcmt nA8fGPwONhU2GlCDlW7N5n+AvEBwMUFhr8zTzZB36K8xIZWpRvuEiTF6wyQrQyLPGekHL Gq91AyHijoVRz9hIaqGf4qXwXY51ms9PO8Kv9pS6d1TVqiM/wqQjJEK+PLxnFWkIcD387 gxIpFvBg+9Ys826FgoMqvmRiVTFOTE7qBmaVSAqB8j3kglNn+z1TrC0AhGuwPKYHJ1w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--justinstitt.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=NOJpOOdz; arc=none smtp.remote-ip=209.85.161.69 Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B3D6606A32D for ; Fri, 4 Dec 2026 19:38:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2B3D6606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--justinstitt.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=NOJpOOdz Received: by mail-oo1-f69.google.com with SMTP id 006d021491bc7-6dd1142710fso1233906eaf.3 for ; Fri, 04 Dec 2026 11:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796413094; x=1797017894; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=OOX0KKXnEd5i6gOeEnOeIrpGhn1IrMdmC2gcu8tKbcE=; b=NOJpOOdzhVNi4N1WCdul8NU+Ysif96RcsWX3QUahfULI4gX9L81CVx/xGXuU4pZeld 2JEzRdqpqcQAXqTWw1u4ImmKibXEkImWqtnaj2VJJpAMNk6ThWzMxtfb0pYEDU+mQ8O+ 5SXrq7xkAarXz9R0AC3G+K1iJR5oOdJ2InY7WEMw7oKd4iW5beQzsMJ5nOiCI4qdZNRW ZdaXaQPBTrcsx6+LZbzbS2KMqKh1SRIEFqrpJlccQbh67F0xmOY8rtIcu2nxImHetf5V VRvv+kwu9U+irRWPciFG063sLaAAbeenm5Z77wYqPN0mDTPR+JhabXSNeiOBSn1np5/8 dRKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796413094; x=1797017894; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OOX0KKXnEd5i6gOeEnOeIrpGhn1IrMdmC2gcu8tKbcE=; b=DKV+yqFXOkFN9mDl/DYgSIeazEmLXLpIZinA7d2RZRLWLRFi1G+XTUBbgE0dpzyWAt IwqW5lSXOHnT3y5Czbb3z+Zxot7oouRpJKkskCghFSM7JAG3QQN7P5u5lW1NhVqg/MPn rKvWUxhsufyBf/zTztc0l8OC2a53k8wH/r+f+eXQUZ/uGfY2AeOl8jxB5/nS2zY0hB2P eo+bF3jZIF2LSIzynQdqgCEeAQfTMHf13LIvyLOFwWyW0Zpc5+LpnNCULVwkR60EdsTC yoIOqs1f/udgQnzSQ9EM8DqSIGn4ZxTDErUa+nY0dOlkdO7EtA+ajRRE5PdXlHJsko8X +rxw== X-Forwarded-Encrypted: i=1; AL+hErEZfJupUwdIhWT8Q5vHWm2TAwGsL+QqW5gkKOPWiRSY+wnEuZraxtdo00qxK8SqVM7u01LsfMQ=@vger.kernel.org X-Gm-Message-State: APuU4Z/tprM4Fw+nvFb8GlnVxWQvITh0t6UabewmMtifw0lIFhoTzTkd l4wpim2oTAGglYhskDJYw/+VxDBuxoYDU6P+/Ckmdi/foPy9y9zP7ee7KXeEboj0UjG26wKVyi2 7/KxyiSS1NYOiOB0iJmmpFx9ZFw== X-Received: from iojj9.prod.google.com ([2002:a05:6602:8209:b0:9ea:3f2b:3781]) (user=justinstitt job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6820:c74b:b0:71a:ee17:febc with SMTP id 006d021491bc7-71bf20a00b1mr2060632eaf.76.1796413093818; Fri, 04 Dec 2026 11:38:13 -0800 (PST) Date: Fri, 4 Dec 2026 11:38:13 -0800 In-Reply-To: <20261203-clk-onecell-count-order-v1-9-2b0e4e8d9ea6@cressey.dev> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261203-clk-onecell-count-order-v1-0-2b0e4e8d9ea6@cressey.dev> <20261203-clk-onecell-count-order-v1-9-2b0e4e8d9ea6@cressey.dev> Message-ID: Subject: Re: [PATCH 09/11] clk: bm1880: Size .hws by the highest clock id From: Justin Stitt To: Ben Cressey Cc: Junhui Liu , Manivannan Sadhasivam , Nobuhiro Iwamatsu , Michal Simek , Stephen Boyd , Brian Masney , Jerome Brunet , Paul Walmsley , Samuel Holland , Emil Renner Berthing , Hal Feng , Nathan Chancellor , Kees Cook , Nick Desaulniers , Bill Wendling , "Gustavo A. R. Silva" , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-riscv@lists.infradead.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org, Harry Austen , Changhuang Liang , stable@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Hi, On Thu, Dec 03, 2026 at 04:15:47PM -0800, Ben Cressey wrote: > bm1880_clk_probe() sizes hws[] by the sum of the five clock tables, but > the array is indexed by clock id. The sum is 68 while the ids in the > tables run from 1 to 68. BM1880_CLK_AXI6 is stored one element past the > end of hws[], which CONFIG_UBSAN_BOUNDS can report, and > of_clk_hw_onecell_get() rejects its index. > > Size hws[] by the highest clock id plus one. Keep that count in the > driver rather than use BM1880_NR_CLKS from the binding header, as in > commit 26ec588063d9 ("clk: nuvoton: ma35d1: Keep the clock count in the > driver"). > > Found by an LLM-assisted review of __counted_by users. > > Fixes: 1ab4601da55b ("clk: Add common clock driver for BM1880 SoC") > Cc: stable@vger.kernel.org > Signed-off-by: Ben Cressey > --- > drivers/clk/clk-bm1880.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/clk/clk-bm1880.c b/drivers/clk/clk-bm1880.c > index da8ff672ee0f9..dc13d90bdd919 100644 > --- a/drivers/clk/clk-bm1880.c > +++ b/drivers/clk/clk-bm1880.c > @@ -53,6 +53,8 @@ > #define BM1880_CLK_DIV27 0xac > #define BM1880_CLK_DIV28 0xb0 > > +#define BM1880_CLK_COUNT (BM1880_CLK_AXI6 + 1) > + > #define to_bm1880_pll_clk(_hw) container_of(_hw, struct bm1880_pll_hw_clock, hw) > #define to_bm1880_div_clk(_hw) container_of(_hw, struct bm1880_div_hw_clock, hw) > > @@ -883,11 +885,7 @@ static int bm1880_clk_probe(struct platform_device *pdev) > if (IS_ERR(sys_base)) > return PTR_ERR(sys_base); > > - num_clks = ARRAY_SIZE(bm1880_pll_clks) + > - ARRAY_SIZE(bm1880_div_clks) + > - ARRAY_SIZE(bm1880_mux_clks) + > - ARRAY_SIZE(bm1880_composite_clks) + > - ARRAY_SIZE(bm1880_gate_clks); > + num_clks = BM1880_CLK_COUNT; > > clk_data = devm_kzalloc_flex(dev, *clk_data, hw_data.hws, num_clks); > if (!clk_data) > > -- > 2.56.0 > Reviewed-by: Justin Stitt Justin