1
0
Fork 0
remarkable-linux/drivers/clk/nxp
Jerome Brunet e6bc3a4b0c clk: divider: fix incorrect usage of container_of
[ Upstream commit 12a26c298d ]

divider_recalc_rate() is an helper function used by clock divider of
different types, so the structure containing the 'hw' pointer is not
always a 'struct clk_divider'

At the following line:
> div = _get_div(table, val, flags, divider->width);

in several cases, the value of 'divider->width' is garbage as the actual
structure behind this memory is not a 'struct clk_divider'

Fortunately, this width value is used by _get_val() only when
CLK_DIVIDER_MAX_AT_ZERO flag is set. This has never been the case so
far when the structure is not a 'struct clk_divider'. This is probably
why we did not notice this bug before

Fixes: afe76c8fd0 ("clk: allow a clk divider with max divisor when zero")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-12 12:32:13 +02:00
..
Makefile clk: add lpc18xx creg clk driver 2016-03-04 12:52:10 -08:00
clk-lpc18xx-ccu.c clk: nxp: clk-lpc18xx-ccu: Unmap region obtained by of_iomap 2016-11-01 17:32:25 -07:00
clk-lpc18xx-cgu.c clk: nxp: Remove CLK_IS_ROOT 2016-03-02 17:45:22 -08:00
clk-lpc18xx-creg.c clk: nxp: Use new macro CLK_OF_DECLARE_DRIVER 2016-08-12 18:00:48 -07:00
clk-lpc32xx.c clk: divider: fix incorrect usage of container_of 2018-04-12 12:32:13 +02:00