From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796412589; b=ZbHYWQKZGrxVo1aYS9tFHIfIIGScHfzM0EGfiqu4Hk6ePDnRvRHckl3iU4qRKOdQPXVB mKlAGlv7z0RzlhZxQAHtcOJ8F5vc5xkdC42BNw/C8mAFR0wsyE26bFIstgl6FQxhxi481 eZMSmh9qhyW1LlufSIYzK0tdAbbuqA7D7tSnQeCzUj5jg2gt6z5AJuaiYsphRsYhTHz6k 5hVU2kwqfvOZx/+O8XjXy82yngg2lsebgGJ8R5u14l7FMkJYov+e/wHpXWx7Pfw7mV5ub JKGqmipY4Wp6Zk7AgAOVJw5GTITThUU1FtQ35yRMoN+O+I/yYlhi7i7Nr7Ng8OVUowQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796412589; 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=M8REf+L1LmtLVoGbDnRKWfw/LSiyhCp271Nqb5eTRuo=; b=K8peDlsaRbtBrAg6ZeXKhgLA0OrlE5Qny1aaXTxDAcElZIATI2HEam9BPtYrxqbu5oUm Vdi3B6CQyPlO518+UmzuiW2eZ4qIzp7N4rlKFo71Ybk8JvTWAikfj3F+Rxi8dF96irhh7 IGFS4Bgckklk7/P4lhLW5kWyWh/QQk5LdxmZBiD15WnHDRG/IDX151vpwfwO8K26sp2TP vJQ0BdAvn5lqodFBfIfoTWwkiwuS/J8l1/IhheOl/7inAVEfiHxaSInqlqPSHJ3De98MV 2+F16A+9tPYVZB3l//FzN+uxx32cuLryw942nS1VpCMXmLCyP3BTL/Zc9GIJHUXbFUg== 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=VbHVEuNz; arc=none smtp.remote-ip=209.85.167.200 Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) (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 3C4FC606A32F for ; Fri, 4 Dec 2026 19:29:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3C4FC606A32F 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=VbHVEuNz Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-4a41f46d629so1762835b6e.3 for ; Fri, 04 Dec 2026 11:29:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796412588; x=1797017388; 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=M8REf+L1LmtLVoGbDnRKWfw/LSiyhCp271Nqb5eTRuo=; b=VbHVEuNzJ6hAcpYvcCFNw4KpkPaw+FntiqVVW5SbXorUkNj2NN9qT9ekYZB0rqTJEo N6ccQwqVH5qZvLqyTpg4ZrwK0nSe6OHGmpcBk3j0z44r5VvxJcXYQxTIpvgnQvF3LxK6 7sAytlFD8CEp+lzXb/m4ZUhg7fHoxaa6NbRwsTKQK2a63+x7DZUe0sOELIlXji/blzbQ /fvxT7WvDcUtcyO4jHV+EeD2gdCsvsjAOiwNYnwmJPxFU5vP8M/db9XHjBbXX2Gm2NGV Xz9cIV1jchbSsrDL/rwXDZcb8GsFCQ8voGeWvuZnqPGKopqc7txUINWdskxZjo9DMrxb ppPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796412588; x=1797017388; 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=M8REf+L1LmtLVoGbDnRKWfw/LSiyhCp271Nqb5eTRuo=; b=TqNvRXFkFOUaDw1a+G634vTVKVHyiolA5KXwu1UEK3UF4OTMWrPZs4bzOXZQxEWfzg 30UlYMkCLP5G2ExJAzVHVn4gl3JAbC8rkGgwe4ez3rBpzStRtDGk+uVNRhpX2eDdMo3z XvaSYsV+m/28tWDF7cOkZarPL62SG35d8JpAcE+3axzDowZA5PFR3cL0sEHmavwY594R 4OiFeOuVbtzLOlFvCBRB5WWMLlwq4cWHA3NMZvRT49pfsREB09T5hdwhkjQRWON3pfDa DPItjRfxlDYuD5K0ltS0GZz5HOs/fmbBMVsy458uLEPto5e1Bg/wpp/c/s3V9sDUJC4O Z81A== X-Forwarded-Encrypted: i=1; AL+hErG5oqkO8FJqjYsnAfVVIWs6vWpAaIvnPfA28psCU7ADugbHryozub9xNV//TzIWKKjZxaGg9nyPECM=@vger.kernel.org X-Gm-Message-State: APuU4Z/l5W/dSyrEEjXZMT7l5noenoujTMAp04shRuXx5e8ZkBr/jbST 08ekScyVn5+gDkqod24Kyp0TPaQcvPYhPzLO7YY3MTHHptnFf3ZH4+aMwmhjCAoA32gJJX+OSju YWmxnQS1WcyJ88TSK/lYQCcwPww== X-Received: from oatk25-n1.prod.google.com ([2002:a05:687c:4399:10b0:4ad:6687:8fcc]) (user=justinstitt job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:14c6:b0:4d6:9153:2965 with SMTP id 5614622812f47-57f208b1526mr3399730b6e.54.1796412587956; Fri, 04 Dec 2026 11:29:47 -0800 (PST) Date: Fri, 4 Dec 2026 11:29:47 -0800 In-Reply-To: <20261203-clk-onecell-count-order-v1-6-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-6-2b0e4e8d9ea6@cressey.dev> Message-ID: Subject: Re: [PATCH 06/11] clk: clocking-wizard: 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 Content-Type: text/plain; charset="us-ascii" Hi, On Thu, Dec 03, 2026 at 04:15:44PM -0800, Ben Cressey wrote: > hws[] is annotated with __counted_by(num), but > clk_wzrd_register_output_clocks() fills it before clk_wzrd_probe() sets > num. The count is still zero with Clang 20 and 21, where > devm_kzalloc_flex() does not set it, and on v6.13 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. Nodes with xlnx,static-config do not reach this code. > > Set num right after the allocation. > > Found by an LLM-assisted check of __counted_by users. > > Fixes: bb487924b161 ("clk: clocking-wizard: use newer clk_hw API") > Cc: stable@vger.kernel.org > Signed-off-by: Ben Cressey > --- > drivers/clk/xilinx/clk-xlnx-clock-wizard.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c > index 9f8830b40122a..d1e9b11da2011 100644 > --- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c > +++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c > @@ -1302,6 +1302,7 @@ static int clk_wzrd_probe(struct platform_device *pdev) > nr_outputs); > if (!clk_wzrd) > return -ENOMEM; > + clk_wzrd->clk_data.num = nr_outputs; > platform_set_drvdata(pdev, clk_wzrd); > > clk_wzrd->base = devm_platform_ioremap_resource(pdev, 0); > @@ -1337,7 +1338,6 @@ static int clk_wzrd_probe(struct platform_device *pdev) > if (ret) > return ret; > > - clk_wzrd->clk_data.num = nr_outputs; > ret = devm_of_clk_add_hw_provider(&pdev->dev, of_clk_hw_onecell_get, > &clk_wzrd->clk_data); > if (ret) { > > -- > 2.56.0 > Reviewed-by: Justin Stitt Justin