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=1796412705; b=udSbWYM0Gn4IOH60PQz96AjqJTSy04Cr9d2Kz1mJlzIQbMR2VfHJekx/MBHWGCZqJ0Vg CbhfLUlL6ahbG9xO5JokZ06Uz7wlW/d4MZAe3YdTHKJwAE6b0LHzyGz6VJLeiXS8FHVhQ Ie99oDwkMdjHbb0flq7ejpBlWUYCaZoIO9ToL35BjgLD6aRn5l/+ycFGByT8OGX0OQ2Fr sL1KsNDhzpuvJhAKPlkx6Ryy3Gybc17mgXKFWA856OkOhWxRu+2tsDyrPjzt/u23p6XUE swcoBWvRqgsSNPWfM2Jb+gPW+FvPwuicm4IMs9JT2XQ6AHsILCUtkY29N25y55a3UDg== 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=ZDUaODxr1+uOJrjdJSaclrfpYoBd4atUqSQSrZBng7ImfTqn2FgrtDpUWZtXDJfDVnqK rUFVkD9Nv9/tK3xfzfRtxPtrAyjkxiNLX5rxFGwvBo8hq/tCHUHEg4a+1NqMM0EGZ2ZZt 0h273K/QLWPRtopyWpIha8Q3fRKy0LY7KIHSJ4DEphRGga8iHbLgpRXEp43J1CBKyjANk GNUaMcyE1oHjfn/cRs4ytR4o8tewrlpNYHizSiKjFpTmXnQhEITtGw2DXM0OiCnF5F3FD wQo1dKJ9rTISlhDtepcE0HR1hppAUZ6OG1zzIsAhErVqTY2ZbTUtKqwvQbNmTV1fURQ== 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=WsHMDwf1; 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 785D3606A32D for ; Fri, 4 Dec 2026 19:31:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 785D3606A32D 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=WsHMDwf1 Received: by mail-oa1-f71.google.com with SMTP id 586e51a60fabf-45eb9967696so1381608fac.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.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=0estKMx2AAuxWFWVx6B6FzVkrRA5KNRUcDUls7b/WuY=; b=WsHMDwf1sx7ciFunvBx3mHYuiaXzB2pHENDbiPpqQWobHr41C5YV+oHrwqYPJnrzg+ L3wYfYnQKDYfrCQCV6JqYd9EM8aHkgi+OoxF07kL6qTklgtdjAOxn/9cvrrO99mFlylD hXp6jGyT4jBIku1Tg6tX85m+SBHjUwtaKlOZeQI/kEaHdQ/U/cGEOXIk38JZKBQnYZIB jjOYjvnY2SgDUbK6bTehVTv/fcxR3fZ2OkY1X1BCK7cGrZG0YFM3b7NOXZszkZscXn2D 4nCeBXLSrwOy80xpoP7apu0l/iuGUPSHCf8JEbnD4rkat6vwWGvjpWJ44qLcQUvq3/u/ isIw== 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=dsAxcyrmCNPd/GspMWuY4wdI4/k01aRsydujwVZjBk3uw+YdwN9KJVHOQNo/Du9vqx 8HT05zIITmPNkoClipCjGGqPK1PKrUQCkrCcL3KPthcWBi1thqWL65figUDzNazJ79bL fyi9Rqpr1D9FMmLYiLZqf5RIda3TPH0Ky8ukiEUfnJTPbwY34RacsLm9y5YyBDnLkKfy 7usZ+WMtE1D8YlfjjD5IhpoZiKp4t8Tblug1c+rXHzT2dAA1C3t0g5DLi0emaAKJdlpP 5XjM5izROhXWMo3SB0wuB56WpHD+dV0TytYtEEQDisjfBIGI5bCUWwosz/cR6e+D+5uK 3iqg== X-Forwarded-Encrypted: i=1; AL+hErEYMd8puEdGnXALwRiVzsfsnQZqcz1lvqM1TsheLIwJjX1tZT/dbp50vFnwn0Dq1O8XMMJb@lists.linux.dev X-Gm-Message-State: AB4q+uHijbnnBwNPqrgJZXPsSbB8KQzUes66fqC8PmxwjrvV7aIjcdlb Jy1eN7HUNcosQGXUvSzYQcNLbCf0XFLVAoRRR7Wuy/2LdROcqGA98HZk3vCjdfhKrsCi/SO44pR 34JmNr+3PoOkNIi8vjUPiBKF8bA== 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: 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-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