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 4EA2D606A322 for ; Fri, 4 Dec 2026 19:22:57 +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=gjaWMZWw; 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=gVJL7P/p 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=aK8W4RmWmHTll2XsKu4CBoQ/yuGzHl8jfzhtqzqhJiI=; b=gjaWMZWwvLVi671XgvwWgz+6rm fKlEIY/kkihI7LWNL4iD0o9S0FKvQ5IlvGgtt19wAHV3QCHpy+lZ2fhoHpAsTo5yzh3wW14Gy3gam BmAa9tjYpM06XXHzRXkftj3x2Ys72NM0/uGG7F09osncr1O4cHjTU5hT8+447++/Ly8N/1DstH0jW G/ncWeYJTq9JLGv4WXszUwrHyGeSSFtJ5oRBet2wj1byvsb2DT7NfavJbs82NT0LXffAied8WcNMd pqjOVegpcZRbfHUrzQk5bG+poMk8l3dS7z7MUWTuYkuS4Xq3XeIEdF6EQHuecvbOJy8R06i51Pe1v FLve+cfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZYrm-00000001Gu7-2ZFS; Fri, 04 Dec 2026 19:22:46 +0000 Received: from mail-ot1-x346.google.com ([2607:f8b0:4864:20::346]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZYrK-00000001Gpp-2Pct for linux-riscv@lists.infradead.org; Fri, 04 Dec 2026 19:22:46 +0000 Received: by mail-ot1-x346.google.com with SMTP id 46e09a7af769-862adf80a1eso1774102a34.2 for ; Fri, 04 Dec 2026 11:21:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796412096; x=1797016896; 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=Je9oU/uw4pGqyoOhCZw2Ijq0xv0z6GNppcJuU0DrjNo=; b=gVJL7P/pwMTSLOaDnps4GBdRwtAS+vy05BWLnE60zNkDm/9rIxBQsI1IsxNTJz1ted GNL9IxlHNnAFeXd83sEQOAGL4g0QQcYoNBnNvn0K5xnPMyTZdjmOCIKGBjs6tIsDXNyw HIv0Nug/73113bwDFqBvXh9Vth3O1YoeuaaksFv3l3s/b5fR94Z6NoKLY2LnIEFwqFpp xrMxiMnQG3LK6TmmzEc67eNEL/H1y5S6qBdzbVJ7bb3eGPcErbKrx9NV94GypTiByknL EBV7IfZcZf8cmsAyjGP1MITS1VqCI9ZAYOJTe0oxVqZlJr8tVWYo2CfmSBEn7U+3aTog hFaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796412096; x=1797016896; 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=Je9oU/uw4pGqyoOhCZw2Ijq0xv0z6GNppcJuU0DrjNo=; b=VX5vpuRQDRbn8afOJIOfouiA4bbPdnDiE5y7r59Bib/rD0pSabNPUlpnZd6LjnYlqt o+61RX5sRMuh43sjc+lSN5TMoWkWnlN2GgQq3BEsagPwlMkLFxKSouPSibE303vrrHk6 isY1S52rzSOvXwvkZV818vjXfg42zQuUltnjeO40PlwKSUfb9+L3eOEEj6B83IP7oe1u iq4fYuP6SBn+unndgtdLIinX5OlDX3ZwGuaudhcQzSGShm6HFcHjR++d5aaQPCGLAt4U a44sRz7qmmos2bI8kzV0v2n26PI7AAV7grb+IcUNVbzSra/V5vy1K55HlGgiL7+dUPeE CS2w== X-Forwarded-Encrypted: i=1; AL+hErH1Ubu1BlW9aa6HpgVwzNZevN9CVu8Q6nHLntTRz7/GROtI+HffwuILfPOokyysP2ucVkLHKDHDxsF4Zw==@lists.infradead.org X-Gm-Message-State: APuU4Z8uXPck3q0bjJHBrq/FNnn2biCNjGikm1Gl/BWVifrNZBn8vIVK QIsPPwfqWOXdXQcf0KGBmuWTDPzlSHSu/05GEm1AAmUpqzhhfEkDkDNriS+r89bakemyJXBzTU1 nupKKHT++zhipv/UOrQtObDjZHg== X-Received: from ioi21-n2.prod.google.com ([2002:a05:6602:c655:20b0:9ea:45c1:e7a2]) (user=justinstitt job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6820:a288:20b0:71b:7bb4:bb70 with SMTP id 006d021491bc7-71bf21b04b3mr1949610eaf.68.1796412095992; Fri, 04 Dec 2026 11:21:35 -0800 (PST) Date: Fri, 4 Dec 2026 11:21:35 -0800 In-Reply-To: <20261203-clk-onecell-count-order-v1-2-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-2-2b0e4e8d9ea6@cressey.dev> Message-ID: Subject: Re: [PATCH 02/11] clk: lmk04832: Assign .num before accessing .hws 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_112243_788326_DDB0B020 X-CRM114-Status: GOOD ( 17.89 ) 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:40PM -0800, Ben Cressey wrote: > hws[] is annotated with __counted_by(num), but > lmk04832_register_clkout() fills it before lmk04832_probe() sets num. > The count is still zero with Clang 20 and 21, where devm_kzalloc_flex() > does not set it, and on v6.6 to v7.3, which use devm_kzalloc(). With > __counted_by enabled, CONFIG_UBSAN_BOUNDS reports the accesses and > CONFIG_UBSAN_TRAP makes the first one trap during probe. > > Set num right after the allocation. > > Found by an LLM-assisted check of __counted_by users. > > Fixes: f316cdff8d67 ("clk: Annotate struct clk_hw_onecell_data with __counted_by") > Cc: stable@vger.kernel.org > Signed-off-by: Ben Cressey > --- > drivers/clk/clk-lmk04832.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/clk/clk-lmk04832.c b/drivers/clk/clk-lmk04832.c > index e6e771e8eb145..ad66cf097b9ba 100644 > --- a/drivers/clk/clk-lmk04832.c > +++ b/drivers/clk/clk-lmk04832.c > @@ -1435,6 +1435,8 @@ static int lmk04832_probe(struct spi_device *spi) > return ret; > } > > + lmk->clk_data->num = info->num_channels; > + > device_property_read_u32(lmk->dev, "ti,vco-hz", &lmk->vco_rate); > > lmk->sysref_ddly = 8; > @@ -1530,7 +1532,6 @@ static int lmk04832_probe(struct spi_device *spi) > } > } > > - lmk->clk_data->num = info->num_channels; > ret = devm_of_clk_add_hw_provider(lmk->dev, of_clk_hw_onecell_get, > lmk->clk_data); > if (ret) { > > -- > 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