linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ssb: Fix division by zero issue in ssb_calc_clock_rate
@ 2023-09-04 23:23 Rand Deeb
  2023-09-05  0:59 ` Larry Finger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rand Deeb @ 2023-09-04 23:23 UTC (permalink / raw)
  To: Michael Buesch, linux-wireless, linux-kernel
  Cc: deeb.rand, lvc-project, voskresenski.stanislav, Rand Deeb

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>
---
 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;
 }
 
 /* Calculate the speed the backplane would run at a given set of clockcontrol values */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ssb: Fix division by zero issue in ssb_calc_clock_rate
  2023-09-04 23:23 [PATCH v2] ssb: Fix division by zero issue in ssb_calc_clock_rate Rand Deeb
@ 2023-09-05  0:59 ` Larry Finger
  2023-09-05  6:20 ` Michael Büsch
  2023-09-07  6:00 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Larry Finger @ 2023-09-05  0:59 UTC (permalink / raw)
  To: Rand Deeb, Michael Buesch, linux-wireless, linux-kernel
  Cc: deeb.rand, lvc-project, voskresenski.stanislav

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@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>
> ---
>   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@lwfinger.net>

Larry

>   
>   /* Calculate the speed the backplane would run at a given set of clockcontrol values */


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ssb: Fix division by zero issue in ssb_calc_clock_rate
  2023-09-04 23:23 [PATCH v2] ssb: Fix division by zero issue in ssb_calc_clock_rate Rand Deeb
  2023-09-05  0:59 ` Larry Finger
@ 2023-09-05  6:20 ` Michael Büsch
  2023-09-07  6:00 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Büsch @ 2023-09-05  6:20 UTC (permalink / raw)
  To: Rand Deeb
  Cc: linux-wireless, linux-kernel, deeb.rand, lvc-project,
	voskresenski.stanislav

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

On Tue,  5 Sep 2023 02:23:46 +0300
Rand Deeb <rand.sec96@gmail.com> wrote:
> --- 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: Michael Büsch <m@bues.ch>


-- 
Michael Büsch
https://bues.ch/

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] ssb: Fix division by zero issue in ssb_calc_clock_rate
  2023-09-04 23:23 [PATCH v2] ssb: Fix division by zero issue in ssb_calc_clock_rate Rand Deeb
  2023-09-05  0:59 ` Larry Finger
  2023-09-05  6:20 ` Michael Büsch
@ 2023-09-07  6:00 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2023-09-07  6:00 UTC (permalink / raw)
  To: Rand Deeb
  Cc: Michael Buesch, linux-wireless, linux-kernel, deeb.rand,
	lvc-project, voskresenski.stanislav, Rand Deeb

Rand Deeb <rand.sec96@gmail.com> 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@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>

Patch applied to wireless-next.git, thanks.

e0b5127fa134 ssb: Fix division by zero issue in ssb_calc_clock_rate

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20230904232346.34991-1-rand.sec96@gmail.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-07 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-04 23:23 [PATCH v2] ssb: Fix division by zero issue in ssb_calc_clock_rate Rand Deeb
2023-09-05  0:59 ` Larry Finger
2023-09-05  6:20 ` Michael Büsch
2023-09-07  6:00 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).