Linux clock framework development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lee Jones" <lee@kernel.org>, linux-clk@vger.kernel.org
Subject: Re: [PATCH 01/10] clk: ti: fapll: Fix output clock array allocation and bounds check
Date: Fri, 27 Nov 2026 19:36:00 +0000	[thread overview]
Message-ID: <sashiko-outbox-238168@kernel.org> (raw)
In-Reply-To: <20261127192620.3443537-2-lee@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] clk: ti: fapll: missing lower-bound check for index 0 in
  ti_fapll_setup()
--

commit a8867d96413dfd436f2d0dca33e4c637a2d0da77
Author: Lee Jones <lee@kernel.org>

clk: ti: fapll: Fix output clock array allocation and bounds check

This commit allocates MAX_FAPLL_OUTPUTS + 1 pointer slots for
fd->outputs.clks and bounds-checks output_instance against
MAX_FAPLL_OUTPUTS.

> diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
> index 7d6a4dd4fc8ce..d5e95e6489cda 100644
> --- a/drivers/clk/ti/fapll.c
> +++ b/drivers/clk/ti/fapll.c
[ ... ]
> @@ -625,6 +624,12 @@ static void __init ti_fapll_setup(struct device_node *node)
>  					       &output_instance))
>  			output_instance = i;
>  
> +		if (output_instance > MAX_FAPLL_OUTPUTS) {
> +			pr_err("%pOFn invalid output_instance %u\n",
> +			       node, output_instance);
> +			continue;
> +		}
> +
>  		freq = fd->base + (output_instance * 8);
>  		div = freq + 4;

[Severity: Medium]
Should this check also reject output_instance == 0?

Child synthesizers are 1-based, while slot 0 of fd->outputs.clks is
populated with the parent pll_clk before this loop and register offsets 0
and 4 are the main PLL control and powerdown registers.  If clock-indices
contains 0 or of_property_read_u32_index() fails on i == 0 and falls back
to output_instance = i, synth_clk aliases the main PLL registers and
overwrites fd->outputs.clks[0].

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127192620.3443537-1-lee@kernel.org?part=1

  reply	other threads:[~2026-11-27 19:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 19:25 [PATCH 00/10] clk: Fix OOB writes, UAFs, ERR_PTR dereferences, and rate-calc bugs (batch 2) Lee Jones
2026-11-27 19:25 ` [PATCH 01/10] clk: ti: fapll: Fix output clock array allocation and bounds check Lee Jones
2026-11-27 19:36   ` sashiko-bot [this message]
2026-11-27 19:25 ` [PATCH 02/10] clk: tegra: bpmp: Drop manual clock unregister on provider failure Lee Jones
2026-11-27 19:36   ` sashiko-bot
2026-11-27 19:25 ` [PATCH 03/10] clk: starfive: jh7110-sys: Use devres for PLL0 clock and notifier Lee Jones
2026-11-27 19:25 ` [PATCH 04/10] clk: starfive: jh7110: Duplicate top clock bulk arrays per device Lee Jones
2026-11-27 19:25 ` [PATCH 05/10] clk: rockchip: cpu: Allocate rate_table before registering notifier Lee Jones
2026-11-27 19:33   ` sashiko-bot
2026-11-27 19:25 ` [PATCH 06/10] clk: tegra: bpmp: Skip ERR_PTR entries in tegra_bpmp_clk_of_xlate() Lee Jones
2026-11-27 19:25 ` [PATCH 07/10] clk: rp1: Propagate determine_rate() return value for PLL dividers Lee Jones
2026-11-27 19:25 ` [PATCH 08/10] clk: rp1: Reference secondary PLL divider clk_hw in parent tables Lee Jones
2026-11-27 19:25 ` [PATCH 09/10] clk: keystone: sci-clk: Check allocation failure before copying clock array Lee Jones
2026-11-27 19:25 ` [PATCH 10/10] clk: versatile: icst: Check kasprintf() and put parent node on error Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-238168@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox