diff options
author | 2005-09-08 17:34:30 +0000 | |
---|---|---|
committer | 2005-09-08 17:34:30 +0000 | |
commit | 2f4d9efd1e8944ba23a562215d53326dbb5d7785 (patch) | |
tree | f43c075cfae093a8fb5e260184a4f78abcb68b1e | |
parent | tell the driver to allocate memory for the size of ath_pci_softc (diff) | |
download | wireguard-openbsd-2f4d9efd1e8944ba23a562215d53326dbb5d7785.tar.xz wireguard-openbsd-2f4d9efd1e8944ba23a562215d53326dbb5d7785.zip |
fix a possible division by zero by using minimal default values for the
beacon interval and the beacon miss timeout (beacon interval * 7).
-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; |