All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath9k_hw: avoid division-by-zero in ani
@ 2010-10-15  0:00 Björn Smedman
  2010-10-15  7:57 ` Felix Fietkau
  0 siblings, 1 reply; 3+ messages in thread
From: Björn Smedman @ 2010-10-15  0:00 UTC (permalink / raw)
  To: Ben Greear, linux-wireless; +Cc: John W. Linville, Luis R. Rodriguez

[-- Attachment #1: Type: TEXT/PLAIN, Size: 747 bytes --]

The ath9k ANI code may under some circumstances do division-by-zero. This 
patch detects and avoids that case.

Reported-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Björn Smedman <bjorn.smedman@venatech.se>
---
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index 3aa8fb1..50a7f89 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -713,6 +713,9 @@ void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
 
 	ath9k_hw_ani_read_counters(ah);
 
+	if (WARN_ON(aniState->listenTime == 0))
+		return;
+
 	ofdmPhyErrRate = aniState->ofdmPhyErrCount * 1000 /
 			 aniState->listenTime;
 	cckPhyErrRate =  aniState->cckPhyErrCount * 1000 /

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

* Re: [PATCH] ath9k_hw: avoid division-by-zero in ani
  2010-10-15  0:00 [PATCH] ath9k_hw: avoid division-by-zero in ani Björn Smedman
@ 2010-10-15  7:57 ` Felix Fietkau
  2010-10-15  8:46   ` Björn Smedman
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Fietkau @ 2010-10-15  7:57 UTC (permalink / raw)
  To: Björn Smedman
  Cc: Ben Greear, linux-wireless, John W. Linville, Luis R. Rodriguez

On 2010-10-15 2:00 AM, Björn Smedman wrote:
> The ath9k ANI code may under some circumstances do division-by-zero. This 
> patch detects and avoids that case.
Should be obsolete with my patch from 3 days ago:
[PATCH 1/3] ath9k_hw: fix division by zero in the ANI monitor code

- Felix

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

* Re: [PATCH] ath9k_hw: avoid division-by-zero in ani
  2010-10-15  7:57 ` Felix Fietkau
@ 2010-10-15  8:46   ` Björn Smedman
  0 siblings, 0 replies; 3+ messages in thread
From: Björn Smedman @ 2010-10-15  8:46 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: Ben Greear, linux-wireless, John W. Linville, Luis R. Rodriguez

2010/10/15 Felix Fietkau <nbd@openwrt.org>:
> On 2010-10-15 2:00 AM, Björn Smedman wrote:
>> The ath9k ANI code may under some circumstances do division-by-zero. This
>> patch detects and avoids that case.
> Should be obsolete with my patch from 3 days ago:
> [PATCH 1/3] ath9k_hw: fix division by zero in the ANI monitor code

Yes it is. Thanks for catching and sorry for the wasted bandwidth.

/Björn

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

end of thread, other threads:[~2010-10-15  8:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-15  0:00 [PATCH] ath9k_hw: avoid division-by-zero in ani Björn Smedman
2010-10-15  7:57 ` Felix Fietkau
2010-10-15  8:46   ` Björn Smedman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.