Patch "ep93xx: clock: Fix off by one in ep93xx_div_recalc_rate()" has been added to the 6.1-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

    ep93xx: clock: Fix off by one in ep93xx_div_recalc_rate()

to the 6.1-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:
     ep93xx-clock-fix-off-by-one-in-ep93xx_div_recalc_rat.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 63130ad07a3aeea4429a4f70dfcb118009e9c48d
Author: Dan Carpenter <alexander.sverdlin@xxxxxxxxx>
Date:   Wed Sep 11 10:39:15 2024 +0300

    ep93xx: clock: Fix off by one in ep93xx_div_recalc_rate()
    
    [ Upstream commit c7f06284a6427475e3df742215535ec3f6cd9662 ]
    
    The psc->div[] array has psc->num_div elements.  These values come from
    when we call clk_hw_register_div().  It's adc_divisors and
    ARRAY_SIZE(adc_divisors)) and so on.  So this condition needs to be >=
    instead of > to prevent an out of bounds read.
    
    Fixes: 9645ccc7bd7a ("ep93xx: clock: convert in-place to COMMON_CLK")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Acked-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>
    Reviewed-by: Nikita Shubin <nikita.shubin@xxxxxxxxxxx>
    Signed-off-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>
    Link: https://lore.kernel.org/r/1caf01ad4c0a8069535813c26c7f0b8ea011155e.camel@xxxxxxxxxx
    Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index 85a496ddc6197..e9f72a529b508 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -359,7 +359,7 @@ static unsigned long ep93xx_div_recalc_rate(struct clk_hw *hw,
 	u32 val = __raw_readl(psc->reg);
 	u8 index = (val & psc->mask) >> psc->shift;
 
-	if (index > psc->num_div)
+	if (index >= psc->num_div)
 		return 0;
 
 	return DIV_ROUND_UP_ULL(parent_rate, psc->div[index]);




[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