[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1121211: UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.8/drivers/clk/samsung/clk-exynos-clkout.c:178:18



Hi Nathan,

* Nathan Chancellor <nathan@kernel.org> [2025-11-22 13:38]:
I bet it is the same problem as the ones I fixed in

 6dc445c19050 ("clk: bcm: rpi: Assign ->num before accessing ->hws")
 9368cdf90f52 ("clk: bcm: dvp: Assign ->num before accessing ->hws")

So something like this?

Cheers,
Nathan

diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
index 5f1a4f5e2e59..5b21025338bd 100644
--- a/drivers/clk/samsung/clk-exynos-clkout.c
+++ b/drivers/clk/samsung/clk-exynos-clkout.c
@@ -175,6 +175,7 @@ static int exynos_clkout_probe(struct platform_device *pdev)
	clkout->mux.shift = EXYNOS_CLKOUT_MUX_SHIFT;
	clkout->mux.lock = &clkout->slock;

+	clkout->data.num = EXYNOS_CLKOUT_NR_CLKS;
	clkout->data.hws[0] = clk_hw_register_composite(NULL, "clkout",
				parent_names, parent_count, &clkout->mux.hw,
				&clk_mux_ops, NULL, NULL, &clkout->gate.hw,
@@ -185,7 +186,6 @@ static int exynos_clkout_probe(struct platform_device *pdev)
		goto err_unmap;
	}

-	clkout->data.num = EXYNOS_CLKOUT_NR_CLKS;
	ret = of_clk_add_hw_provider(clkout->np, of_clk_hw_onecell_get, &clkout->data);
	if (ret)
		goto err_clk_unreg;


This fixes it for me, feel free to add a

Tested-by: Jochen Sprickerhof <jochen@sprickerhof.de>

Thanks!

Jochen

Attachment: signature.asc
Description: PGP signature


Reply to: