[PATCH master 1/3] clk: at91: sama5d2: fix buffer overflow of clk parent_names

Sascha Hauer s.hauer at pengutronix.de
Mon Sep 14 09:19:07 EDT 2020


On Wed, Sep 02, 2020 at 03:13:05PM +0200, Ahmad Fatoum wrote:
> The upstream implementation passes the clock's parent_names as an
> address of a local array to the core. That's ok because data contained
> in struct clk_init_data is duplicated and stored with a proper lifetime.
> 
> We don't have that in barebox, so the clock providers themselves are
> responsible for allocating an array with suitable lifetime. Most at91
> clk drivers did this by having a fixed size array in the clock's private
> data struct.
> 
> Since 47475fa5e0e1 ("clk: at91: add sama5d2 audio PLL support"), we are
> overflowing struct clk_programmable::parent_names on the sama5d2,
> because there it has 6 parents, while only space for 5 were allocated.
> 
> Make the parent_names member of variable size to fix this and to avoid
> such errors in future.
> 
> Fixes: 47475fa5e0e1 ("clk: at91: add sama5d2 audio PLL support")
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  drivers/clk/at91/clk-i2s-mux.c      | 7 +++----
>  drivers/clk/at91/clk-master.c       | 7 +++----
>  drivers/clk/at91/clk-programmable.c | 6 +++---
>  drivers/clk/at91/clk-slow.c         | 5 +++--
>  drivers/clk/at91/clk-smd.c          | 5 +++--
>  drivers/clk/at91/clk-usb.c          | 5 +++--
>  drivers/clk/at91/sckc.c             | 5 +++--
>  7 files changed, 21 insertions(+), 19 deletions(-)

Applied to master, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list