Skip to content
Snippets Groups Projects
Commit f6b1340d authored by Colin Ian King's avatar Colin Ian King Committed by Stephen Boyd
Browse files

clk: uniphier: Fix potential infinite loop


The for-loop iterates with a u8 loop counter i and compares this
with the loop upper limit of num_parents that is an int type.
There is a potential infinite loop if num_parents is larger than
the u8 loop counter. Fix this by making the loop counter the same
type as num_parents.  Also make num_parents an unsigned int to
match the return type of the call to clk_hw_get_num_parents.

Addresses-Coverity: ("Infinite loop")
Fixes: 734d82f4 ("clk: uniphier: add core support code for UniPhier clock driver")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20210409090104.629722-1-colin.king@canonical.com


Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent a38fd874
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment