linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* Re: 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
       [not found] <176383554642.17713.6408785381758213911.reportbug@vis>
@ 2025-11-22 20:07 ` Salvatore Bonaccorso
  2025-11-22 20:38   ` Nathan Chancellor
  0 siblings, 1 reply; 4+ messages in thread
From: Salvatore Bonaccorso @ 2025-11-22 20:07 UTC (permalink / raw)
  To: Jochen Sprickerhof, Krzysztof Kozlowski, Sylwester Nawrocki,
	Chanwoo Choi, Alim Akhtar, Michael Turquette, Stephen Boyd
  Cc: 1121211, linux-samsung-soc, linux-clk, linux-arm-kernel,
	linux-kernel

Hi,

Jochen reported the folowing while booting 6.17.8 based kernel in
Debian:

On Sat, Nov 22, 2025 at 07:19:06PM +0100, Jochen Sprickerhof wrote:
> Package: src:linux
> Version: 6.17.8-1
> Severity: normal
> 
> First time booting into 6.17.8-1 and first time I see UBSAN in my logs:
> 
> [Nov21 08:31] Booting Linux on physical CPU 0x100
> [  +0,012977] ------------[ cut here ]------------
> [  +0,000017] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.8/drivers/clk/samsung/clk-exynos-clkout.c:178:18
> [  +0,000038] index 0 is out of range for type 'clk_hw *[*]'
> [  +0,000025] CPU: 4 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.8+deb14-armmp #1 NONE  Debian 6.17.8-1
> [  +0,000018] Hardware name: Samsung Exynos (Flattened Device Tree)
> [  +0,000007] Call trace:
> [  +0,000009]  unwind_backtrace from show_stack+0x18/0x1c
> [  +0,000042]  show_stack from dump_stack_lvl+0x54/0x68
> [  +0,000036]  dump_stack_lvl from ubsan_epilogue+0x8/0x34
> [  +0,000025]  ubsan_epilogue from __ubsan_handle_out_of_bounds+0x88/0x8c
> [  +0,000024]  __ubsan_handle_out_of_bounds from exynos_clkout_probe+0x38c/0x428
> [  +0,000029]  exynos_clkout_probe from platform_probe+0x64/0x98
> [  +0,000034]  platform_probe from really_probe+0xd8/0x3ac
> [  +0,000031]  really_probe from __driver_probe_device+0x94/0x1dc
> [  +0,000027]  __driver_probe_device from driver_probe_device+0x3c/0xd8
> [  +0,000027]  driver_probe_device from __driver_attach+0xd8/0x1d8
> [  +0,000028]  __driver_attach from bus_for_each_dev+0x84/0xd4
> [  +0,000026]  bus_for_each_dev from bus_add_driver+0xf4/0x218
> [  +0,000023]  bus_add_driver from driver_register+0x8c/0x140
> [  +0,000027]  driver_register from do_one_initcall+0x50/0x24c
> [  +0,000023]  do_one_initcall from kernel_init_freeable+0x288/0x2fc
> [  +0,000022]  kernel_init_freeable from kernel_init+0x24/0x140
> [  +0,000022]  kernel_init from ret_from_fork+0x14/0x28
> [  +0,000015] Exception stack(0xf0835fb0 to 0xf0835ff8)
> [  +0,000012] 5fa0:                                     00000000 00000000 00000000 00000000
> [  +0,000011] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [  +0,000009] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> [  +0,000007] ---[ end trace ]---
> [  +0,000226] ------------[ cut here ]------------
> [  +0,000012] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.8/drivers/clk/samsung/clk-exynos-clkout.c:183:29
> [  +0,000032] index 0 is out of range for type 'clk_hw *[*]'
> [  +0,000021] CPU: 4 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.8+deb14-armmp #1 NONE  Debian 6.17.8-1
> [  +0,000014] Hardware name: Samsung Exynos (Flattened Device Tree)
> [  +0,000006] Call trace:
> [  +0,000006]  unwind_backtrace from show_stack+0x18/0x1c
> [  +0,000032]  show_stack from dump_stack_lvl+0x54/0x68
> [  +0,000033]  dump_stack_lvl from ubsan_epilogue+0x8/0x34
> [  +0,000023]  ubsan_epilogue from __ubsan_handle_out_of_bounds+0x88/0x8c
> [  +0,000020]  __ubsan_handle_out_of_bounds from exynos_clkout_probe+0x354/0x428
> [  +0,000024]  exynos_clkout_probe from platform_probe+0x64/0x98
> [  +0,000031]  platform_probe from really_probe+0xd8/0x3ac
> [  +0,000031]  really_probe from __driver_probe_device+0x94/0x1dc
> [  +0,000031]  __driver_probe_device from driver_probe_device+0x3c/0xd8
> [  +0,000028]  driver_probe_device from __driver_attach+0xd8/0x1d8
> [  +0,000027]  __driver_attach from bus_for_each_dev+0x84/0xd4
> [  +0,000025]  bus_for_each_dev from bus_add_driver+0xf4/0x218
> [  +0,000023]  bus_add_driver from driver_register+0x8c/0x140
> [  +0,000027]  driver_register from do_one_initcall+0x50/0x24c
> [  +0,000022]  do_one_initcall from kernel_init_freeable+0x288/0x2fc
> [  +0,000019]  kernel_init_freeable from kernel_init+0x24/0x140
> [  +0,000020]  kernel_init from ret_from_fork+0x14/0x28
> [  +0,000016] Exception stack(0xf0835fb0 to 0xf0835ff8)
> [  +0,000010] 5fa0:                                     00000000 00000000 00000000 00000000
> [  +0,000009] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [  +0,000009] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> [  +0,000098] ---[ end trace ]---

Can you have a look into it? The downstream report is at
https://bugs.debian.org/1121211

Regards,
Salvatore


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 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
  2025-11-22 20:07 ` 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 Salvatore Bonaccorso
@ 2025-11-22 20:38   ` Nathan Chancellor
  2025-11-23  7:57     ` Salvatore Bonaccorso
  2025-11-23 20:33     ` Jochen Sprickerhof
  0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2025-11-22 20:38 UTC (permalink / raw)
  To: Salvatore Bonaccorso
  Cc: Jochen Sprickerhof, Krzysztof Kozlowski, Sylwester Nawrocki,
	Chanwoo Choi, Alim Akhtar, Michael Turquette, Stephen Boyd,
	1121211, linux-samsung-soc, linux-clk, linux-arm-kernel,
	linux-kernel, linux-hardening, Kees Cook

On Sat, Nov 22, 2025 at 09:07:40PM +0100, Salvatore Bonaccorso wrote:
> Hi,
> 
> Jochen reported the folowing while booting 6.17.8 based kernel in
> Debian:
> 
> On Sat, Nov 22, 2025 at 07:19:06PM +0100, Jochen Sprickerhof wrote:
> > Package: src:linux
> > Version: 6.17.8-1
> > Severity: normal
> > 
> > First time booting into 6.17.8-1 and first time I see UBSAN in my logs:
> > 
> > [Nov21 08:31] Booting Linux on physical CPU 0x100
> > [  +0,012977] ------------[ cut here ]------------
> > [  +0,000017] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.8/drivers/clk/samsung/clk-exynos-clkout.c:178:18
> > [  +0,000038] index 0 is out of range for type 'clk_hw *[*]'
> > [  +0,000025] CPU: 4 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.8+deb14-armmp #1 NONE  Debian 6.17.8-1
> > [  +0,000018] Hardware name: Samsung Exynos (Flattened Device Tree)
> > [  +0,000007] Call trace:
> > [  +0,000009]  unwind_backtrace from show_stack+0x18/0x1c
> > [  +0,000042]  show_stack from dump_stack_lvl+0x54/0x68
> > [  +0,000036]  dump_stack_lvl from ubsan_epilogue+0x8/0x34
> > [  +0,000025]  ubsan_epilogue from __ubsan_handle_out_of_bounds+0x88/0x8c
> > [  +0,000024]  __ubsan_handle_out_of_bounds from exynos_clkout_probe+0x38c/0x428
> > [  +0,000029]  exynos_clkout_probe from platform_probe+0x64/0x98
> > [  +0,000034]  platform_probe from really_probe+0xd8/0x3ac
> > [  +0,000031]  really_probe from __driver_probe_device+0x94/0x1dc
> > [  +0,000027]  __driver_probe_device from driver_probe_device+0x3c/0xd8
> > [  +0,000027]  driver_probe_device from __driver_attach+0xd8/0x1d8
> > [  +0,000028]  __driver_attach from bus_for_each_dev+0x84/0xd4
> > [  +0,000026]  bus_for_each_dev from bus_add_driver+0xf4/0x218
> > [  +0,000023]  bus_add_driver from driver_register+0x8c/0x140
> > [  +0,000027]  driver_register from do_one_initcall+0x50/0x24c
> > [  +0,000023]  do_one_initcall from kernel_init_freeable+0x288/0x2fc
> > [  +0,000022]  kernel_init_freeable from kernel_init+0x24/0x140
> > [  +0,000022]  kernel_init from ret_from_fork+0x14/0x28
> > [  +0,000015] Exception stack(0xf0835fb0 to 0xf0835ff8)
> > [  +0,000012] 5fa0:                                     00000000 00000000 00000000 00000000
> > [  +0,000011] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > [  +0,000009] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > [  +0,000007] ---[ end trace ]---
> > [  +0,000226] ------------[ cut here ]------------
> > [  +0,000012] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.8/drivers/clk/samsung/clk-exynos-clkout.c:183:29
> > [  +0,000032] index 0 is out of range for type 'clk_hw *[*]'
> > [  +0,000021] CPU: 4 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.8+deb14-armmp #1 NONE  Debian 6.17.8-1
> > [  +0,000014] Hardware name: Samsung Exynos (Flattened Device Tree)
> > [  +0,000006] Call trace:
> > [  +0,000006]  unwind_backtrace from show_stack+0x18/0x1c
> > [  +0,000032]  show_stack from dump_stack_lvl+0x54/0x68
> > [  +0,000033]  dump_stack_lvl from ubsan_epilogue+0x8/0x34
> > [  +0,000023]  ubsan_epilogue from __ubsan_handle_out_of_bounds+0x88/0x8c
> > [  +0,000020]  __ubsan_handle_out_of_bounds from exynos_clkout_probe+0x354/0x428
> > [  +0,000024]  exynos_clkout_probe from platform_probe+0x64/0x98
> > [  +0,000031]  platform_probe from really_probe+0xd8/0x3ac
> > [  +0,000031]  really_probe from __driver_probe_device+0x94/0x1dc
> > [  +0,000031]  __driver_probe_device from driver_probe_device+0x3c/0xd8
> > [  +0,000028]  driver_probe_device from __driver_attach+0xd8/0x1d8
> > [  +0,000027]  __driver_attach from bus_for_each_dev+0x84/0xd4
> > [  +0,000025]  bus_for_each_dev from bus_add_driver+0xf4/0x218
> > [  +0,000023]  bus_add_driver from driver_register+0x8c/0x140
> > [  +0,000027]  driver_register from do_one_initcall+0x50/0x24c
> > [  +0,000022]  do_one_initcall from kernel_init_freeable+0x288/0x2fc
> > [  +0,000019]  kernel_init_freeable from kernel_init+0x24/0x140
> > [  +0,000020]  kernel_init from ret_from_fork+0x14/0x28
> > [  +0,000016] Exception stack(0xf0835fb0 to 0xf0835ff8)
> > [  +0,000010] 5fa0:                                     00000000 00000000 00000000 00000000
> > [  +0,000009] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > [  +0,000009] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > [  +0,000098] ---[ end trace ]---
> 
> Can you have a look into it? The downstream report is at
> https://bugs.debian.org/1121211

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;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: 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
  2025-11-22 20:38   ` Nathan Chancellor
@ 2025-11-23  7:57     ` Salvatore Bonaccorso
  2025-11-23 20:33     ` Jochen Sprickerhof
  1 sibling, 0 replies; 4+ messages in thread
From: Salvatore Bonaccorso @ 2025-11-23  7:57 UTC (permalink / raw)
  To: Nathan Chancellor, 1121211, Jochen Sprickerhof
  Cc: Krzysztof Kozlowski, Sylwester Nawrocki, Chanwoo Choi,
	Alim Akhtar, Michael Turquette, Stephen Boyd, linux-samsung-soc,
	linux-clk, linux-arm-kernel, linux-kernel, linux-hardening,
	Kees Cook

Hi Nathan,

On Sat, Nov 22, 2025 at 01:38:56PM -0700, Nathan Chancellor wrote:
> On Sat, Nov 22, 2025 at 09:07:40PM +0100, Salvatore Bonaccorso wrote:
> > Hi,
> > 
> > Jochen reported the folowing while booting 6.17.8 based kernel in
> > Debian:
> > 
> > On Sat, Nov 22, 2025 at 07:19:06PM +0100, Jochen Sprickerhof wrote:
> > > Package: src:linux
> > > Version: 6.17.8-1
> > > Severity: normal
> > > 
> > > First time booting into 6.17.8-1 and first time I see UBSAN in my logs:
> > > 
> > > [Nov21 08:31] Booting Linux on physical CPU 0x100
> > > [  +0,012977] ------------[ cut here ]------------
> > > [  +0,000017] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.8/drivers/clk/samsung/clk-exynos-clkout.c:178:18
> > > [  +0,000038] index 0 is out of range for type 'clk_hw *[*]'
> > > [  +0,000025] CPU: 4 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.8+deb14-armmp #1 NONE  Debian 6.17.8-1
> > > [  +0,000018] Hardware name: Samsung Exynos (Flattened Device Tree)
> > > [  +0,000007] Call trace:
> > > [  +0,000009]  unwind_backtrace from show_stack+0x18/0x1c
> > > [  +0,000042]  show_stack from dump_stack_lvl+0x54/0x68
> > > [  +0,000036]  dump_stack_lvl from ubsan_epilogue+0x8/0x34
> > > [  +0,000025]  ubsan_epilogue from __ubsan_handle_out_of_bounds+0x88/0x8c
> > > [  +0,000024]  __ubsan_handle_out_of_bounds from exynos_clkout_probe+0x38c/0x428
> > > [  +0,000029]  exynos_clkout_probe from platform_probe+0x64/0x98
> > > [  +0,000034]  platform_probe from really_probe+0xd8/0x3ac
> > > [  +0,000031]  really_probe from __driver_probe_device+0x94/0x1dc
> > > [  +0,000027]  __driver_probe_device from driver_probe_device+0x3c/0xd8
> > > [  +0,000027]  driver_probe_device from __driver_attach+0xd8/0x1d8
> > > [  +0,000028]  __driver_attach from bus_for_each_dev+0x84/0xd4
> > > [  +0,000026]  bus_for_each_dev from bus_add_driver+0xf4/0x218
> > > [  +0,000023]  bus_add_driver from driver_register+0x8c/0x140
> > > [  +0,000027]  driver_register from do_one_initcall+0x50/0x24c
> > > [  +0,000023]  do_one_initcall from kernel_init_freeable+0x288/0x2fc
> > > [  +0,000022]  kernel_init_freeable from kernel_init+0x24/0x140
> > > [  +0,000022]  kernel_init from ret_from_fork+0x14/0x28
> > > [  +0,000015] Exception stack(0xf0835fb0 to 0xf0835ff8)
> > > [  +0,000012] 5fa0:                                     00000000 00000000 00000000 00000000
> > > [  +0,000011] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > > [  +0,000009] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > > [  +0,000007] ---[ end trace ]---
> > > [  +0,000226] ------------[ cut here ]------------
> > > [  +0,000012] UBSAN: array-index-out-of-bounds in /build/reproducible-path/linux-6.17.8/drivers/clk/samsung/clk-exynos-clkout.c:183:29
> > > [  +0,000032] index 0 is out of range for type 'clk_hw *[*]'
> > > [  +0,000021] CPU: 4 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.17.8+deb14-armmp #1 NONE  Debian 6.17.8-1
> > > [  +0,000014] Hardware name: Samsung Exynos (Flattened Device Tree)
> > > [  +0,000006] Call trace:
> > > [  +0,000006]  unwind_backtrace from show_stack+0x18/0x1c
> > > [  +0,000032]  show_stack from dump_stack_lvl+0x54/0x68
> > > [  +0,000033]  dump_stack_lvl from ubsan_epilogue+0x8/0x34
> > > [  +0,000023]  ubsan_epilogue from __ubsan_handle_out_of_bounds+0x88/0x8c
> > > [  +0,000020]  __ubsan_handle_out_of_bounds from exynos_clkout_probe+0x354/0x428
> > > [  +0,000024]  exynos_clkout_probe from platform_probe+0x64/0x98
> > > [  +0,000031]  platform_probe from really_probe+0xd8/0x3ac
> > > [  +0,000031]  really_probe from __driver_probe_device+0x94/0x1dc
> > > [  +0,000031]  __driver_probe_device from driver_probe_device+0x3c/0xd8
> > > [  +0,000028]  driver_probe_device from __driver_attach+0xd8/0x1d8
> > > [  +0,000027]  __driver_attach from bus_for_each_dev+0x84/0xd4
> > > [  +0,000025]  bus_for_each_dev from bus_add_driver+0xf4/0x218
> > > [  +0,000023]  bus_add_driver from driver_register+0x8c/0x140
> > > [  +0,000027]  driver_register from do_one_initcall+0x50/0x24c
> > > [  +0,000022]  do_one_initcall from kernel_init_freeable+0x288/0x2fc
> > > [  +0,000019]  kernel_init_freeable from kernel_init+0x24/0x140
> > > [  +0,000020]  kernel_init from ret_from_fork+0x14/0x28
> > > [  +0,000016] Exception stack(0xf0835fb0 to 0xf0835ff8)
> > > [  +0,000010] 5fa0:                                     00000000 00000000 00000000 00000000
> > > [  +0,000009] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> > > [  +0,000009] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
> > > [  +0,000098] ---[ end trace ]---
> > 
> > Can you have a look into it? The downstream report is at
> > https://bugs.debian.org/1121211
> 
> 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;

Thank you very much. Jochen, can you test the patch and report back?

Regards,
Salvatore


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 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
  2025-11-22 20:38   ` Nathan Chancellor
  2025-11-23  7:57     ` Salvatore Bonaccorso
@ 2025-11-23 20:33     ` Jochen Sprickerhof
  1 sibling, 0 replies; 4+ messages in thread
From: Jochen Sprickerhof @ 2025-11-23 20:33 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Salvatore Bonaccorso, Krzysztof Kozlowski, Sylwester Nawrocki,
	Chanwoo Choi, Alim Akhtar, Michael Turquette, Stephen Boyd,
	1121211, linux-samsung-soc, linux-clk, linux-arm-kernel,
	linux-kernel, linux-hardening, Kees Cook

[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-23 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <176383554642.17713.6408785381758213911.reportbug@vis>
2025-11-22 20:07 ` 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 Salvatore Bonaccorso
2025-11-22 20:38   ` Nathan Chancellor
2025-11-23  7:57     ` Salvatore Bonaccorso
2025-11-23 20:33     ` Jochen Sprickerhof

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).