public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@amd.com>
To: Padmarao Begari <padmarao.begari@amd.com>, u-boot@lists.denx.de
Cc: git@amd.com, Lukasz Majewski <lukma@denx.de>,
	Tom Rini <trini@konsulko.com>,
	Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>
Subject: Re: [PATCH] clk: versal: Fix out-of-bounds parent id for DUMMY_PARENT
Date: Tue, 7 Apr 2026 13:10:34 +0200	[thread overview]
Message-ID: <2de3343d-d8a3-4b10-a1fe-a60525418b09@amd.com> (raw)
In-Reply-To: <20260327101053.900154-1-padmarao.begari@amd.com>



On 3/27/26 11:10, Padmarao Begari wrote:
> When a clock parent entry is DUMMY_PARENT (0xFFFFFFFE), masking it
> with CLK_PARENTS_ID_MASK (0xFFFF) produces the value 0xFFFE (65534).
> This value is stored in parent->id and later used as a clock array
> index in versal_clock_get_parentid(). Since clock_max_idx is
> typically 228, accessing clock[65534] is out-of-bounds, and the
> garbage value read is used as a clock ID in subsequent clock rate
> calculations, eventually causing U-Boot to crash. This is observed
> as a crash during "clk dump" on AMD Versal Gen 2.
> 
> Fix this by setting parent->id = 0 for DUMMY_PARENT entries.
> 
> Fixes: 95105089afe2 ("clk: versal: Add clock driver support")
> Signed-off-by: Padmarao Begari <padmarao.begari@amd.com>
> ---
>   drivers/clk/clk_versal.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/clk_versal.c b/drivers/clk/clk_versal.c
> index 78a2410ca21..2e0c382ef30 100644
> --- a/drivers/clk/clk_versal.c
> +++ b/drivers/clk/clk_versal.c
> @@ -326,6 +326,7 @@ static int __versal_clock_get_parents(struct clock_parent *parents, u32 *data,
>   		parent = &parents[i];
>   		parent->id = data[i] & CLK_PARENTS_ID_MASK;
>   		if (data[i] == DUMMY_PARENT) {
> +			parent->id = 0;
>   			strcpy(parent->name, "dummy_name");
>   			parent->flag = 0;
>   		} else {

Applied.
M

      reply	other threads:[~2026-04-07 11:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 10:10 [PATCH] clk: versal: Fix out-of-bounds parent id for DUMMY_PARENT Padmarao Begari
2026-04-07 11:10 ` Michal Simek [this message]

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=2de3343d-d8a3-4b10-a1fe-a60525418b09@amd.com \
    --to=michal.simek@amd.com \
    --cc=git@amd.com \
    --cc=lukma@denx.de \
    --cc=padmarao.begari@amd.com \
    --cc=siva.durga.prasad.paladugu@amd.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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