[PATCH v5 01/14] clk: microchip: mpfs: fix clk_cfg array bounds violation

Stephen Boyd sboyd at kernel.org
Wed Sep 28 17:32:13 PDT 2022


Quoting Stephen Boyd (2022-09-28 17:30:28)
> Quoting Conor Dooley (2022-09-09 05:31:10)
> > There is an array bounds violation present during clock registration,
> > triggered by current code by only specific toolchains. This seems to
> > fail gracefully in v6.0-rc1, using a toolchain build from the riscv-
> > gnu-toolchain repo and with clang-15, and life carries on. While
> > converting the driver to use standard clock structs/ops, kernel panics
> > were seen during boot when built with clang-15:
> > 
> [...]
> > 
> > If parent is RTCREF, so the macro becomes: &mpfs_cfg_clks[33].cfg.hw
> > which is well beyond the end of the array. Amazingly, builds with GCC
> > 11.1 see no problem here, booting correctly and hooking the parent up
> > etc. Builds with clang-15 do not, with the above panic.
> > 
> > Change the macro to use specific offsets depending on the parent rather
> > than the dt-binding's clock IDs.
> > 
> > Fixes: 1c6a7ea32b8c ("clk: microchip: mpfs: add RTCREF clock control")
> > CC: Nathan Chancellor <nathan at kernel.org>
> > Signed-off-by: Conor Dooley <conor.dooley at microchip.com>
> > ---
> 
> I'll merge this patch over to clk-fixes as well.

Great I see it's already split out and on fixes branch. Thanks!



More information about the linux-riscv mailing list