Re: [PATCH v2] clk: rs9: Add clock index range check to rs9_of_clk_get()

From: Marek Vasut

Date: Wed Jan 21 2026 - 05:39:21 EST


On 1/21/26 10:34 AM, Geert Uytterhoeven wrote:

Hello Geert,

diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c
index aa108df12e44fb9f..1adc5365ba1a3d59 100644
--- a/drivers/clk/clk-renesas-pcie.c
+++ b/drivers/clk/clk-renesas-pcie.c
@@ -277,6 +277,9 @@ rs9_of_clk_get(struct of_phandle_args *clkspec, void *data)
struct rs9_driver_data *rs9 = data;
unsigned int idx = clkspec->args[0];

+ if (idx >= rs9->chip_info->num_clks)

of_clk_src_onecell_get() does a pr_err("%s: invalid clock index %u\n",
__func__, idx); on error, should this function do the same ?

I can add it if you want. But this function will (hopefully) be
short-lived anyway.
This will be backported to stable, the rewrite to onecell won't, so this will be long lived in stable backports. Please add it. Thank you !