Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base()

Off-by-one will happen when index == ARRAY_SIZE(ur->base).

Fixes: b14cbdfd467d ("clk: ux500: Add driver for the reset portions of PRCC")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Link: https://lore.kernel.org/r/20220518062537.17933-1-hbh25y@gmail.com
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Hangyu Hua and committed by
Stephen Boyd
bea0b66e 639d5661

+1 -1
+1 -1
drivers/clk/ux500/reset-prcc.c
··· 58 58 prcc_num = id / PRCC_PERIPHS_PER_CLUSTER; 59 59 index = prcc_num_to_index(prcc_num); 60 60 61 - if (index > ARRAY_SIZE(ur->base)) 61 + if (index >= ARRAY_SIZE(ur->base)) 62 62 return NULL; 63 63 64 64 return ur->base[index];