Linux clock framework development
 help / color / mirror / Atom feed
From: Prasanna Kumar T S M <ptsm@linux.microsoft.com>
To: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>,
	sboyd@kernel.org, bmasney+clk@redhat.com,
	jbrunet+clk@baylibre.com, michal.simek@amd.com,
	shubhrajyoti.datta@amd.com
Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	git@amd.com, Beesam Sridhar Sagar <sagar.beesamsridhar@amd.com>
Subject: Re: [PATCH 1/3] clk: zynqmp: Fix off-by-one loop bound in zynqmp_clock_get_topology()
Date: Tue, 1 Dec 2026 18:51:03 +0530	[thread overview]
Message-ID: <407e0835-bae2-4a51-b2c6-007b6d1ee05d@linux.microsoft.com> (raw)
In-Reply-To: <20261201064353.238312-2-radhey.shyam.pandey@amd.com>



On 01-12-2026 12:13, Radhey Shyam Pandey wrote:
> From: Beesam Sridhar Sagar <sagar.beesamsridhar@amd.com>
> 
> The topology fetch loop iterates while j <= MAX_NODES, allowing one
> extra iteration that queries firmware with an offset of MAX_NODES and
> writes into topology[] past its MAX_NODES-sized bounds via
> __zynqmp_clock_get_topology(). Change the condition to j < MAX_NODES
> so the loop never issues a request that can overflow the topology
> array.
> 
> Fixes: 3fde0e16d016 ("drivers: clk: Add ZynqMP clock driver")
> Signed-off-by: Beesam Sridhar Sagar <sagar.beesamsridhar@amd.com>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
> ---
>   drivers/clk/zynqmp/clkc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
> index d62f1901d0ab..9650c67336e6 100644
> --- a/drivers/clk/zynqmp/clkc.c
> +++ b/drivers/clk/zynqmp/clkc.c
> @@ -450,7 +450,7 @@ static int zynqmp_clock_get_topology(u32 clk_id,
>   	struct topology_resp response = { };
>   
>   	*num_nodes = 0;
> -	for (j = 0; j <= MAX_NODES; j += ARRAY_SIZE(response.topology)) {
> +	for (j = 0; j < MAX_NODES; j += ARRAY_SIZE(response.topology)) {
>   		ret = zynqmp_pm_clock_get_topology(clock[clk_id].clk_id, j,
>   						   &response);
>   		if (ret)

Looks good to me.

Reviewed-by: Prasanna Kumar T S M <ptsm@linux.microsoft.com>

  reply	other threads:[~2026-12-01 13:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  6:43 [PATCH 0/3] clk: zynqmp: fix out-of-bounds accesses in firmware clock parsing Radhey Shyam Pandey
2026-12-01  6:43 ` [PATCH 1/3] clk: zynqmp: Fix off-by-one loop bound in zynqmp_clock_get_topology() Radhey Shyam Pandey
2026-12-01 13:21   ` Prasanna Kumar T S M [this message]
2026-12-01  6:43 ` [PATCH 2/3] clk: zynqmp: Fix unbounded parent array overflow in clock parent lookup Radhey Shyam Pandey
2026-12-01 13:34   ` Prasanna Kumar T S M
2026-12-01  6:43 ` [PATCH 3/3] clk: zynqmp: Fix unchecked type index into clock topology tables Radhey Shyam Pandey
2026-12-01  6:54   ` sashiko-bot
2026-12-01 13:21   ` Prasanna Kumar T S M

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=407e0835-bae2-4a51-b2c6-007b6d1ee05d@linux.microsoft.com \
    --to=ptsm@linux.microsoft.com \
    --cc=bmasney+clk@redhat.com \
    --cc=git@amd.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=radhey.shyam.pandey@amd.com \
    --cc=sagar.beesamsridhar@amd.com \
    --cc=sboyd@kernel.org \
    --cc=shubhrajyoti.datta@amd.com \
    /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