From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.70 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796413095; b=z1pFfkWCzGt+KTepvjcUyUmiQwyhmXSgvDINt79jTphVbbE8ljAU27A1L41XPhV0qBzS vagcvoFgydX7FMHYfw/o+R2TrrXv60ZB2/72j1O3F78XulpyOl/pooTY+vLU1xfbrFhxL 1uQBlDQdyV3H1B88SIHkyfzUp7OvzdwXGbUi5ii38HF0BAUGf5LBx22pw5LIvd3wXXBcA 4PWk/VY7TVhO0NiOYvjJfYraJhesoIHx74RuxCAGbNA/Cb83hXSEQGq3upWwJVYCQOOwH lpcM47g8Fw2gBTyTm5qM4hmo/Iul8DFxiUYx8zNRTbx6jBxCE+PZSiRxCqUqwQuqRPQ== 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=UodwOBsVl/WychTFhNYyMhbMSqwZeTxrirsj1ohUFrSOjiy2IIGx5/8gHx3K+lcsJx3r DaIWD2N7QPKfzIM47zsKp/oA4xvTBwyTK1pgQKHsU0tuuLewnBQLsiWOQWAo8PpqtJe52 BS6vs8J+MkgkQA3MKv5DypnNAXh6TlHj7xZHy2gvLayqGswAbpfRfpxeXnnY/tAHierUi BxmNW5p871cqpsaSDjHzm+PT1+q3bluY0+AC/nY1nTWSirMjfZUD3XMg8obBAUcjNoBgr CMrVpZ4sd9b/G+/Je8Le8joTUQqHvhq4EDnHMa2mfwUNaDJHiSmjo7nLTKE+zZU5N8g== 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=Bcpx+GH1; arc=none smtp.remote-ip=209.85.161.70 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (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 2BE66606A332 for ; Fri, 4 Dec 2026 19:38:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2BE66606A332 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=Bcpx+GH1 Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-71be386bb06so1670583eaf.1 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=lists.linux.dev; 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=Bcpx+GH1qLBG9BwtFxIlJHxzULgYPGj1LESux6lb+y4oe2DBZUQ5EPVbx0VVv6LQXk 5Vje8Wtwh0k3XSyP+8SpQ/7eFzMhPdHRcbE1W9eC7p3388KyGRu/OnqGfIAGoHZN34PW pemfAR9uitRH6lQM6lRM5lQHJDf665B/f5EEAAeakO1sVSz+4snDFN6skh9bvYXicntX HMYz1F9qrQSwxhw8o1Uan0XbJBMklxKWA31MUmDOmPJYYrBaXMuzJXibOVkcAHkMxEtM 17zvS6r4N8pi38adzRmpepuhjDlWFDAlGMLiVuXtEydzw2JwMupqtcg3KXiizgTX9x/c hKCw== 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=qpL0klAyg/feMTuJUDZrkRL4skWmPxhJHtIo1vIuaObaBpdak78RQu8hZtbOXlJ8ld ZWlZrQB+dTXlX9laSdMPZUNCrDp0G17ZaU/ux/hJLnx9RZFCdyQS/RcPGnQgjQJU+RPO KeT9vMaN1vlQcuPRtgavD3pCV95X3QUSSvEVjZU3wDQeKCnlPzjNyariVypKPXkgI/Bo BvyjreyYG1A/DUYtC36Ah1We15+gbnwiP1JPHYWm5Nrn6eIHqoXO21pNv5VYKrTJoUBu 5hNr5peVJ/QXPwcM3Tj09ZUByfGGjlmfNiKJcWtK0CdA1DiODYRl/k3i//Z+0f13Hdap zD/g== X-Forwarded-Encrypted: i=1; AL+hErHcHgjiR9kxrj58nj3vtrdUfsgkgZHJ32d1SP2rDurF2EqL2F5rHaTyMQrNZ3ldac9JataO@lists.linux.dev X-Gm-Message-State: APuU4Z9v0iQNIskPxZwN+EBNrZYv0iRkUm7INjnJst8sknflnSRI/G59 +2kdF1kd5uUc57oG8zZm0K5i8nXkDSIbdKuWzODK6KBuc+RqynGBZDAPAyFu0hf/4cao8vp4H9U B5WrL0mtDsqR0mvdJAnUoLXeXhw== 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: llvm@lists.linux.dev 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