linux-stable/drivers/clk/uniphier
Colin Ian King f6b1340dc7 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: 734d82f4a6 ("clk: uniphier: add core support code for UniPhier clock driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20210409090104.629722-1-colin.king@canonical.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
2021-04-12 19:09:59 -07:00
..
clk-uniphier-core.c drivers/clk: convert VL struct to struct_size 2019-11-08 08:36:12 -08:00
clk-uniphier-cpugear.c clk: uniphier: use semicolons rather than commas to separate statements 2020-10-13 17:43:03 -07:00
clk-uniphier-fixed-factor.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
clk-uniphier-fixed-rate.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
clk-uniphier-gate.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
clk-uniphier-mio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
clk-uniphier-mux.c clk: uniphier: Fix potential infinite loop 2021-04-12 19:09:59 -07:00
clk-uniphier-peri.c clk: uniphier: Add SCSSI clock gate for each channel 2020-01-04 23:14:22 -08:00
clk-uniphier-sys.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
clk-uniphier.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00