From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.72 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796412705; b=pbsAZdYYga6GnyTDuHHo28ZTJxmyGYWM6XoAzPHGVOS34wNwXQDB98NrGsDIVsEm5y0f VFl0Y/jga7XKUDrbYllN3lvqvFY5EknJqn1LXQg3ONJ7nCt9FvS6+TvL34wMv7C91f7Xv 2A+kCTQGO355kk67fPpII2dl677wKDH7KSBdSvBQHkMDNzkCzXhwDCnqBKK30IWqE1PIM qNGUq4DKhOij7lGqTH+6697zvMU2VTAF53ykfxnbWc9gTCqhDjGKxcCc6Mmae1Y28f7oF Sgn4pRxbEKX9CX5IJk7I4EJq7t//daAT3L4z0m6VP3XwWFyFNFE+SXXEDEs2vw5OH5Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796412705; 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=0estKMx2AAuxWFWVx6B6FzVkrRA5KNRUcDUls7b/WuY=; b=wb+r6rOKhd/hm7ibHXiwy/hz3MatPtcvnMfnJ2jS/9oXXv3cOAruxmB74jnYdr/sjkBQ ERIdV+8Dy4eomwKzGIbwBIJ5CdBf5mLa09K6vZwDs4jg/3C48HZse7W4GT1ZjpYaS9xsc KplO8KQ55vBB+y7b+ClL3j7nHDsoMg4TvmVvlWuirpyKkCG2poFyG0N6mXHPSF+PMwhr1 ykQqDOnOo6Bsq8CcjqOzgpr124qKnO/OgJpaz+j0G8ViKeu0aGZlPXo34n/F85N8l/e1S c1KF+ayEZXxDNnZ+JCioHoLp8yoFrvymbdwPJ9gDI5zxe3mZDcDULw2HbBEAc/9aLkw== 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=CfGJKgq+; arc=none smtp.remote-ip=209.85.160.72 Received: from mail-oa1-f72.google.com (mail-oa1-f72.google.com [209.85.160.72]) (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 6847E606A322 for ; Fri, 4 Dec 2026 19:31:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6847E606A322 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=CfGJKgq+ Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-4a8eeb3386bso1498985fac.0 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=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=0estKMx2AAuxWFWVx6B6FzVkrRA5KNRUcDUls7b/WuY=; b=CfGJKgq+02JKG6XTWpdBEFBoOTxiJpUuq5pyGMxAa5v/CCdYDIW2tyXSbpRthq8RSF gDZDpbrYEFdGF6zFS0RTo11xwWDfsHZP2coW+JKPY0xwhmdb6G7uZNak/gHeuquoy3C4 aF72gm27sb+Aj1CA5RtzvNZCW23Es2HQqEInXzSX54u/UCcn9HV0ro1NRSJSZBa8LRX1 GI62dohtQvagD7N2BQMkxRLEuJsywHGEnifTiNXMbuuqZgHrowtLP05q9/0Swbaclxl8 vY+BDvm+d02Ixa/kfXW/3ZeALBkuIhIapKWER5hYW/dTyyazmiBc4zKCp7ViVlIaKmia daSw== 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=i3o3hHa9nEGSizQOAVLb99HbpgFesNkUFQbV2Y+R0Qk+tGvm0sGZ5YZWY/Sd+B+PS1 69i8OtLEzukL3TRPLTB4xI+bBSc2BKa3vDDzyQFn+jCKdDfLJrKDzSTHS8DvuSwCVQNA l/FNrEjZFwckCaHnHUKYxP/HknmPIkH8LDL0DTtYSJLGxrICZKA7uu7k3k+RGCmQv//v AU1AlUMFsya8Rlv7KslbvB/+EC13gMkyGiZRlO8W08wk5UbOO/156c/ZI6pLDWavJCfu phmM6/iVKELhgtmIixZsVntAZFFXXJ9kM3/SyHkwlyVVeclhfKp7UvshbvCwuh13CO1b qXWw== X-Forwarded-Encrypted: i=1; AL+hErG26Iab6kqf2rjasnDoXbHhhqu8HUMPxAwSHvHQHXCW2dVBDrtCWcV5Gvc7mQHpivmtpDEVac95Qcs=@vger.kernel.org X-Gm-Message-State: AB4q+uEpOWIlsn7x+Xc868dpBNcnR7YXXLGz3AWu48tx6yZO09UT4dyS enLjXmmKljIXwer7h+n97Ro9JjfCvLfJp5/X7H6czHqU9DnH4h1iSE8he18Dm5Vvqnq+dVl2P+H IkzxEBpjSenjJwskHLXPdvKKweg== 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-Mailing-List: linux-clk@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-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 Content-Type: text/plain; charset="us-ascii" 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