Skip to content

Commit

Permalink
clk: ux500: fix a possible off-by-one in u8500_prcc_reset_base()
Browse files Browse the repository at this point in the history
Off-by-one will happen when index == ARRAY_SIZE(ur->base).

Fixes: b14cbdf ("clk: ux500: Add driver for the reset portions of PRCC")
Signed-off-by: Hangyu Hua <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
  • Loading branch information
HBh25Y authored and bebarino committed May 18, 2022
1 parent 639d566 commit bea0b66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/clk/ux500/reset-prcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void __iomem *u8500_prcc_reset_base(struct u8500_prcc_reset *ur,
prcc_num = id / PRCC_PERIPHS_PER_CLUSTER;
index = prcc_num_to_index(prcc_num);

if (index > ARRAY_SIZE(ur->base))
if (index >= ARRAY_SIZE(ur->base))
return NULL;

return ur->base[index];
Expand Down

0 comments on commit bea0b66

Please sign in to comment.