[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <96eb9ff2-a687-bbd5-9cb1-4b044f7deae3@lwfinger.net>
Date: Mon, 4 Sep 2023 19:59:03 -0500
From: Larry Finger <Larry.Finger@...inger.net>
To: Rand Deeb <rand.sec96@...il.com>, Michael Buesch <m@...s.ch>,
linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: deeb.rand@...fident.ru, lvc-project@...uxtesting.org,
voskresenski.stanislav@...fident.ru
Subject: Re: [PATCH v2] ssb: Fix division by zero issue in ssb_calc_clock_rate
On 9/4/23 18:23, Rand Deeb wrote:
> 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@...inger.net> and Michael Büsch <m@...s.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@...il.com>
> ---
> drivers/ssb/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
> index 0a26984acb2c..9e54bc7eec66 100644
> --- a/drivers/ssb/main.c
> +++ b/drivers/ssb/main.c
> @@ -835,7 +835,7 @@ static u32 clkfactor_f6_resolve(u32 v)
> case SSB_CHIPCO_CLK_F6_7:
> return 7;
> }
> - return 0;
> + return 1;
> }
Acked-by: Larry Finger <Larry.Finger@...inger.net>
Larry
>
> /* Calculate the speed the backplane would run at a given set of clockcontrol values */
Powered by blists - more mailing lists