From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86808606A322 for ; Fri, 4 Dec 2026 19:32:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=lx5qoNUU; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=Z3kKZyO1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Unsubscribe-Post:List-Owner; bh=DbDgf3owOVJait0c49rxDqi1DaGeSutl+j/ugATDBCE=; b=lx5qoNUU2X7hYMAjnHuWtx+dYk 3Cyu9Rq3dEm8XK3hl48v6HaUBtHnRcGq7FGQ71EslqDLjA0jHK3xp8rqzMtvuM5p+LPQe0w7dY5x0 ncUtKz1AsvuFDycc4j2CL4a0DSgAJEYgdOkid+/PFxWl1E4wWDiKvaQnvRp7SoG9p3jVAadAw1KM2 ge1y97rzApPjTAiioAYE2aj41RR4aELLViv2944QY+Q6oKGtxYf5916KOw26NP/Drsbt54xJzTbgp qs9kVk1TIM76YQnPyx4jOZdcr+dPXRYC7vASDRrkBOPd051Tnpfzucu0rIdEJWblhgGca8+kEan7P wriu2+eA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZZ0c-00000001Ism-00c7; Fri, 04 Dec 2026 19:31:54 +0000 Received: from mail-oa1-x48.google.com ([2001:4860:4864:20::48]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZZ0X-00000001Ior-1EKV for linux-riscv@lists.infradead.org; Fri, 04 Dec 2026 19:31:51 +0000 Received: by mail-oa1-x48.google.com with SMTP id 586e51a60fabf-45eb9967696so1381613fac.1 for ; Fri, 04 Dec 2026 11:31:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796412704; x=1797017504; darn=lists.infradead.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=0estKMx2AAuxWFWVx6B6FzVkrRA5KNRUcDUls7b/WuY=; b=Z3kKZyO15CtuhWMHQA1lLa50dGZtW7RIUSBc6eAP90pnBGoYarR0wn/84yKOJ0V3DE ofNJvcX5qtjjYrDXkJLYqWH2MaPLIpkCb05R56Wl6PTd+4CkWbn/bSW+vRyzO/uyTcgQ IyJC/1QahCoS1CbEWgZvqeb0FUXyd/Pr33UmBlTyCmF2ezX7pIwZ9IHuzK4YaugWxi38 AWpLRjkcm5FujV2WruWJei1x6LOUnXggc3fNfZ3dbpZf9s3ctMml41SAhKhpR2mMdimS WA7F0GGaLTbTqUVJwBngW3Wt8uitziqbVP8LapiQx7cVH9Xqe91vuMtY33q0PApPhGi9 SPSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796412704; x=1797017504; 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=0estKMx2AAuxWFWVx6B6FzVkrRA5KNRUcDUls7b/WuY=; b=sd4e0OKZ668qT/YfhKDRuC9jZyXEeO4J0G1Naz9idrnleESO7YkMyV0mcSqoYDUVlP aEX+Q6XO7nKutuO4j/v9k/0nTaqCzopzjjm9ya5GHjqv5NZbLTO/JEiJ42Lw3d3vFL6h gc6R3jG5y3z0ZXN3Hosn15oH3DibyfUq9+s3GCWYE5/Wwib18CEgceEdBr/WTVEPvyg+ 1Go2abXmSjyXn1EVyI5H4t2+OjvL5o5zrsi13F+lE3UR36w1ZgonFYCVM6EsCEW+a7QG GUoMj9BhNhBd10ht72LlUvISxfuFjsaMKBqYebVx4gsrEOD4LIiKdxjMmk6z4Jk96v1w COZg== X-Forwarded-Encrypted: i=1; AL+hErEJPyjzos03WlvsNw2OhMicGw9J1y+uWdvVZumE90Ck9mgYPlTNjAVGmxtblSVXoVAp5qx4bew/a8NavQ==@lists.infradead.org X-Gm-Message-State: AB4q+uFx3N0mCOTBs2SSu5MS08aFTBx87+wpr19DlIbwn5aLd4L3CJCM mHzFPf+gnMGQlWZi8kcwJzqn+A0TvztKx3UkC+K8gK2yM4NUrvgOJraNLIJHV1voUKnch3oKg4U 8y6yADHJMucovoTVtWTgBo3AkoA== X-Received: from oabgw10-n1.prod.google.com ([2002:a05:6870:a14a:10b0:4a7:1cc1:e72]) (user=justinstitt job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6870:8a14:b0:493:c06d:7700 with SMTP id 586e51a60fabf-4e0e13d190cmr4537313fac.25.1796412704101; Fri, 04 Dec 2026 11:31:44 -0800 (PST) Date: Fri, 4 Dec 2026 11:31:43 -0800 In-Reply-To: <20261203-clk-onecell-count-order-v1-8-2b0e4e8d9ea6@cressey.dev> X-Archived-By: Mime-Version: 1.0 References: <20261203-clk-onecell-count-order-v1-0-2b0e4e8d9ea6@cressey.dev> <20261203-clk-onecell-count-order-v1-8-2b0e4e8d9ea6@cressey.dev> Message-ID: Subject: Re: [PATCH 08/11] clk: starfive: jh7100: Assign .num_reg before accessing .reg 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_113149_398577_8583F137 X-CRM114-Status: GOOD ( 16.46 ) X-Spam-Score: -9.5 (---------) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-14.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Hi, On Thu, Dec 03, 2026 at 04:15:46PM -0800, Ben Cressey wrote: > reg[] is annotated with __counted_by(num_reg), but > clk_starfive_jh7100_probe() does not set num_reg. The count stays zero > with Clang 20 and 21, where devm_kzalloc_flex() does not set it, and on > v6.14 to v7.3, which use devm_kzalloc(). With __counted_by enabled, > CONFIG_UBSAN_BOUNDS reports the accesses and CONFIG_UBSAN_TRAP makes the > probe trap. > > Set num_reg as the other jh71x0 drivers do. > > Found by an LLM-assisted check of __counted_by users. > > Fixes: 838c0a41d7ed ("clk: starfive: Make _clk_get become a common helper function") > Cc: # 6.14.x > Signed-off-by: Ben Cressey > --- > drivers/clk/starfive/clk-starfive-jh7100.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/clk/starfive/clk-starfive-jh7100.c b/drivers/clk/starfive/clk-starfive-jh7100.c > index 079da88ec66cf..c16343a41b21c 100644 > --- a/drivers/clk/starfive/clk-starfive-jh7100.c > +++ b/drivers/clk/starfive/clk-starfive-jh7100.c > @@ -291,6 +291,7 @@ static int __init clk_starfive_jh7100_probe(struct platform_device *pdev) > return -ENOMEM; > > spin_lock_init(&priv->rmw_lock); > + priv->num_reg = JH7100_CLK_PLL0_OUT; > priv->dev = &pdev->dev; > priv->base = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(priv->base)) > > -- > 2.56.0 > Reviewed-by: Justin Stitt Justin _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv