summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRand Deeb <rand.sec96@gmail.com>2023-09-05 02:23:46 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-29 17:30:27 +0200
commit17e61f866ca14769bd27d1b2e655c19585d5d75c (patch)
tree3758098b266e8ff11e238c52f6315c34d9f0094e
parentc51eadf27045f90796bbe64747e40302f1c1765b (diff)
downloadlinux-17e61f866ca14769bd27d1b2e655c19585d5d75c.tar.gz
linux-17e61f866ca14769bd27d1b2e655c19585d5d75c.tar.bz2
linux-17e61f866ca14769bd27d1b2e655c19585d5d75c.zip
ssb: Fix division by zero issue in ssb_calc_clock_rate
[ Upstream commit e0b5127fa134fe0284d58877b6b3133939c8b3ce ] In ssb_calc_clock_rate(), there is a potential issue where the value of m1 could be zero due to initialization using clkfactor_f6_resolv(). This situation raised concerns about the possibility of a division by zero error. We fixed it by following the suggestions provided by Larry Finger <Larry.Finger@lwfinger.net> and Michael Büsch <m@bues.ch>. The fix involves returning a value of 1 instead of 0 in clkfactor_f6_resolv(). This modification ensures the proper functioning of the code and eliminates the risk of division by zero errors. Signed-off-by: Rand Deeb <rand.sec96@gmail.com> Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Acked-by: Michael Büsch <m@bues.ch> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/20230904232346.34991-1-rand.sec96@gmail.com Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/ssb/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 8a93c83cb6f8..d52e91258e98 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -837,7 +837,7 @@ static u32 clkfactor_f6_resolve(u32 v)
case SSB_CHIPCO_CLK_F6_7:
return 7;
}
- return 0;
+ return 1;
}
/* Calculate the speed the backplane would run at a given set of clockcontrol values */