Patch "clk: uniphier: Fix potential infinite loop" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    clk: uniphier: Fix potential infinite loop

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     clk-uniphier-fix-potential-infinite-loop.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4fa39f53a03aef1c2f3dcb596e1ba4569ef663f4
Author: Colin Ian King <colin.king@xxxxxxxxxxxxx>
Date:   Fri Apr 9 10:01:03 2021 +0100

    clk: uniphier: Fix potential infinite loop
    
    [ Upstream commit f6b1340dc751a6caa2a0567b667d0f4f4172cd58 ]
    
    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: 734d82f4a678 ("clk: uniphier: add core support code for UniPhier clock driver")
    Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
    Reviewed-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20210409090104.629722-1-colin.king@xxxxxxxxxxxxx
    Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/uniphier/clk-uniphier-mux.c b/drivers/clk/uniphier/clk-uniphier-mux.c
index 462c84321b2d..1998e9d4cfc0 100644
--- a/drivers/clk/uniphier/clk-uniphier-mux.c
+++ b/drivers/clk/uniphier/clk-uniphier-mux.c
@@ -31,10 +31,10 @@ static int uniphier_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 static u8 uniphier_clk_mux_get_parent(struct clk_hw *hw)
 {
 	struct uniphier_clk_mux *mux = to_uniphier_clk_mux(hw);
-	int num_parents = clk_hw_get_num_parents(hw);
+	unsigned int num_parents = clk_hw_get_num_parents(hw);
 	int ret;
 	unsigned int val;
-	u8 i;
+	unsigned int i;
 
 	ret = regmap_read(mux->regmap, mux->reg, &val);
 	if (ret)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux