From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796412706; b=VAxu+jvOVFeMd+twsNxcXgXjkJosc+8mu7WsYW1Vk/Y2k5XQjMVzq2WZnCXREbWTexn/ ZpyX47xjHvMrYoTRtbU27gepqzLd9XbxO00RwUgOsE0O7a7U+oahYPqWNTLdBRexPH3/4 1ygFQmLKd3V7OdoupPuZs7wsGtZYa3PfCkYz3RmbF4vm49AHoUqCKCBUHQ7d+TAv1LNjI gzj1DrZKkqWSXXLQn64xjPfrvrsYO8/BRS4EnfuHlotYh++Wkc2ALdCAEfGVbIL2YvaLX PvSYkLGzwLdYUpdU9CGMdZSbnF4hEnzSa/SJDlODuL0Dxs9wfaEU2Bz66jADFTefbIw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796412706; 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=ZWU9mPhiIqQHjOHdUyJCwWow/4N3qDvNhQr71rQ91JKRE5XIlWq2+GVLKHGVrNA+mA4x t5BNduvZm6h7An8fG2J7WHbaiTkhWYJVmPD3mwVABzms/TOB1+Ji4dSL8sU3KtdEZOzjV L4zb+M8RWRXNM5EJMl1v2rbJb6RJaxBE/Ulzk4mT4a8QBKUmVGw0SBE8hQpRtAfKoCeU2 CQsDDNCSRLhKlwiasCM4E1oGmQ+M1MqjLVze4/XzIx6lUX/e/ChuZ+YucUomKs1ilfjtN IyIHr7Tgj61RjsqBh48EQ3WH3rknjhQHmTPGRPb/Y7EQHEFUdtBSAFBlhgr62IrvAEA== 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.71 Received: from mail-oa1-f71.google.com (mail-oa1-f71.google.com [209.85.160.71]) (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 78539606A32C for ; Fri, 4 Dec 2026 19:31:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 78539606A32C 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-f71.google.com with SMTP id 586e51a60fabf-4a8eeb3386bso1498993fac.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=hMQGXftPENi0sn7HZ7exT5QYeM2GcfbD4uHVTL2TOpwE2r9OJ0oNP3SwbTkZz0hjW6 5h+FqW5m7javYYDbVeSrdrfxI35JS2lp+zUFMda0ozn/Hgo4yv6XuA5WQm7G+SrzIiug ThMYWUOPfjQL6KmvV1lq4fjdJnZvUQzu98bdbkreJ9L/frHDlqwcVmrC71TwfXE0a3sr 80jfBBq2hKsXxDmKHN/4YydVgBFQUY6JRW6patMgqsGWMr66iVn30xcftamcXTFblTmk clTPkeYFVXPRqcu5bSZe0bikWHnrZdy5WrdCue1mt7xRqki/Bs64XB8qRKkmOg2Fv5AX Calw== X-Forwarded-Encrypted: i=1; AL+hErFrv2GHfZVxmiX3LtjURBg0bT3sJkvK2ToyfVEPRZRu+6J+WyBG40PlbWZXSTEyrus/rkwvQFk=@vger.kernel.org X-Gm-Message-State: AB4q+uHseudooOZcx9W3pYeZO4eghYi0/BRaa2zejzrDWhkQHSh0l/ms Oc0UzNUNBHM0gZda5EOGK6M3orm8LVvTWrsoOR8saIUnz5TdvJUjyrH8F2vU0iPZFVhiAvDJAMI oUrFu/eX+iVnLUDC36YHLoA7WwQ== 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: 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-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