mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@mailbox.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-clk@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: rs9: Convert to clk_hw_onecell_data and of_clk_hw_onecell_get()
Date: Tue, 20 Jan 2026 10:59:15 +0100	[thread overview]
Message-ID: <6d7b4e5f-fb33-47f7-8600-4127d2eef069@mailbox.org> (raw)
In-Reply-To: <CAMuHMdWfEHcNwPCVPXeAO3Sk8U=p0nMVUksiwmMnnkf0LYmnjg@mail.gmail.com>

On 1/20/26 10:12 AM, Geert Uytterhoeven wrote:

Hello Geert,

> On Mon, 19 Jan 2026 at 20:36, Marek Vasut <marek.vasut@mailbox.org> wrote:
>> On 1/19/26 4:23 PM, Geert Uytterhoeven wrote:
>>> rs9_of_clk_get() does not validate the clock index in the passed
>>> DT clock specifier.  If DT specifies an incorrect and out-of-range
>>> index, this may access memory beyond the end of the fixed-size clk_dif[]
>>> array.
>>>
>>> Instead of fixing this by adding a range check to rs9_of_clk_get(),
>>> convert the driver to use the of_clk_hw_onecell_get() helper, which
>>> already contains such a check.  Embedding a clk_hw_onecell_data
>>> structure in the rs9_driver_data structure has the added benefit that
>>> the clock array always has the correct size, and thus can no longer
>>> become out of sync when adding support for new rs9 variants.
>>>
>>> Fixes: 892e0ddea1aa6f70 ("clk: rs9: Add Renesas 9-series PCIe clock generator driver")
>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>> ---
>>> While this patch applies on top of "[PATCH v2] clk: rs9: Reserve 8
>>> struct clk_hw slots for for 9FGV0841", it can be applied or backported
>>> without, by ignoring the change from "clk_dif[4]" to "clk_dif[8]".
>>
>> Since the 9FGV0841 is the biggest part in the 9FGV series, the one-liner
>> fix I posted is better suited as a stable backport. This rework
>> shouldn't have the Fixes tag, since it is only that, a rework.
> 
> This is not just a rework, as it also fixes a second issue.
> But since you prefer simpler fixes, I have submitted a v2 that just
> adds the missing range check[2].  We can revisit the conversion to
> of_clk_hw_onecell_get() later, after all fixes have landed.
This is nice, thank you !

      reply	other threads:[~2026-01-20  9:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19 15:23 Geert Uytterhoeven
2026-01-19 19:36 ` Marek Vasut
2026-01-20  9:12   ` Geert Uytterhoeven
2026-01-20  9:59     ` Marek Vasut [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=6d7b4e5f-fb33-47f7-8600-4127d2eef069@mailbox.org \
    --to=marek.vasut@mailbox.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /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

all inboxes | Powered by JetHome®