From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796412705; b=wXcgM5gCK/JFuUzcVYi79iZWzuoADgU0oc15Nj/vW2ADImbxhXe1+GrFWEIXW/HHUk3x mP9/1R3ZBSetqZsfW49QdWfHvzj8DcimJrEydW74EwPdCCG/Mgv3A+VN91QzFfF0ryV9t sHNg7mty9vWRAFj6vHUwUfKYQOZAEbWqhhHRW3U/YXNit3Blc1uRzlmB65nN+fWCi0aFQ IQrTe29R0V9rg8snjezfGQE1t1acX+jNV0Y/t5kZpcZkIgEpwBcSVGbbFgbtPOoLVv/OB R8H6ar/fVkMK2hcsph7hE0O6kYzZmjvE20vHxITL9OMddCz+73P61rCMm0tZyIBDe5g== 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=V26+mulhzoHLfuXjmQJcg+Qg+g2g+/xvsjBs4MyIBZRHbaDOxP3RZkUm/AsAmVEwJqZT AcWfq33xr0EYbzYwqMzavtecW2ad/oFUGSUjN0k1cNQ1ikPKCLCsgDVV4uKs5h4AZSXGs r9XxGEXB+ApRyWMkeyCJCjGQQyUzfmRyN0Z1uZnzKvgrOmPDFwSS9qBRtQKNG6ZCpd11T d3ntLZCYOOEKkPAgzMmIXNMtne9FMQjeYkZABa3jAseW5IcGu7hGl5su2+ZqISt59UHKJ rCIjE1NIthVymcKjkrh362qbRqqHMWgFDGXakyeBKjiYca599FwwjTDi2Pqh7fogtJQ== 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.69 Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.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 87CE3606A32F for ; Fri, 4 Dec 2026 19:31:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 87CE3606A32F 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-f69.google.com with SMTP id 586e51a60fabf-4a8eeb3386bso1498995fac.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=QTe64XPuBgpaWhn4o2+iaUWHhlBRXg6Fp3XyhRzeQuUtModzSUBvB0E7isQvfSykJf sT4URzlJWqCeAr3KvlrKCJ2TnxdyT/KoqS6qmv0nlvaaOj3Cg2JhdPGwAQvRc204NPDa RCvfNrnUQP8FsfAaczNIL/Q9pguN0YhkkD2Dv5WJcpzPsA5nriaxtidS3QnATAZMC1Q1 8sly4FUgHb5ohYJiz4xBuJ3YQjauqZUgyULUw5aVdqel5yGtvKSPtNOiPQw0f8WqCUBo FhpD3vcez/iWeJL0Oi1Tw50h6bOaD2xZtGGFk7GzXMWJRx5zGSfSJjOyvnOtHPLEbL4O guYg== X-Forwarded-Encrypted: i=1; AL+hErHAPNtD6PIP5Roz+Nozam1h1PE1KRbz4WqF4qB8t6o8XvW7GRvH34s4U1LS8Hu/vbIPwe9mOao9xqScsYRUQdU=@vger.kernel.org X-Gm-Message-State: AB4q+uF/fYGr3vb6KbmZzKIvGs63pD4tdQ8wui0N5H8CtsBrF8K56rGG aXeMLixrGHwekLrXWR4eu8rmYIhaK3P3tvO4cTuq4LRk4KHV2arQZHsIZq0tRuWKSvc7ytgQlwP RJQUQGFLRywZj8mHndYYodQAgnw== 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-hardening@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