]> git.baikalelectronics.ru Git - kernel.git/commit
clk: stm32: Fix out-by-one error path in the index lookup
authorDaniel Thompson <daniel.thompson@linaro.org>
Sun, 28 Jun 2015 09:55:32 +0000 (10:55 +0100)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 2 Jul 2015 16:51:26 +0000 (09:51 -0700)
commitcf25ce8cc40c803e974c0db9cb3a1b2684992118
tree2a96fa167916c61250de1400736a7e3523f7226b
parent0c07ac84d69ebcea0dcbe1b22b6d0ec0304da346
clk: stm32: Fix out-by-one error path in the index lookup

If stm32f4_rcc_lookup() is called with primary == 0 and secondary == 192
then it will read beyond the end of the table array due to an out-by-one
error in the range check.

In addition to the fixing the inequality we also modify the r.h.s. to
make it even more explicit that we are comparing against the size of
table in bits.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Fixes: 843641414cd7 ("clk: stm32: Add clock driver for STM32F4[23]xxx devices")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk-stm32f4.c