diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-09-08 17:34:31 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-09-08 17:34:31 +0000 |
commit | 78140726e1d0be5e0e3f889cc8a2ea58fa5197b5 (patch) | |
tree | 8cbea9bc8f1c61aa67a023746c5c6f9a29588f56 /sys/dev | |
parent | 834f3e10ceabdbdb5000c38628f93b68e94ae9e5 (diff) |
fix a possible division by zero by using minimal default values for the
beacon interval and the beacon miss timeout (beacon interval * 7).
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/ath.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index a7c4ecd524e..bab1704d49c 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ath.c,v 1.37 2005/09/08 12:44:55 jsg Exp $ */ +/* $OpenBSD: ath.c,v 1.38 2005/09/08 17:34:30 reyk Exp $ */ /* $NetBSD: ath.c,v 1.37 2004/08/18 21:59:39 dyoung Exp $ */ /*- @@ -1463,7 +1463,7 @@ ath_beacon_config(struct ath_softc *sc) nexttbtt = (LE_READ_4(ni->ni_tstamp + 4) << 22) | (LE_READ_4(ni->ni_tstamp) >> 10); - intval = MS_TO_TU(ni->ni_intval) & HAL_BEACON_PERIOD; + intval = MAX(1, ni->ni_intval) & HAL_BEACON_PERIOD; if (nexttbtt == 0) { /* e.g. for ap mode */ nexttbtt = intval; } else if (intval) { @@ -1488,7 +1488,7 @@ ath_beacon_config(struct ath_softc *sc) * TU's and then calculate based on the beacon interval. * Note that we clamp the result to at most 10 beacons. */ - bmisstime = MS_TO_TU(ic->ic_bmisstimeout); + bmisstime = MAX(7, ic->ic_bmisstimeout); bs.bs_bmissthreshold = howmany(bmisstime, intval); if (bs.bs_bmissthreshold > 7) { bs.bs_bmissthreshold = 7; |