summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorniallo <niallo@openbsd.org>2006-08-23 21:37:04 +0000
committerniallo <niallo@openbsd.org>2006-08-23 21:37:04 +0000
commitebc1e070275751cd967c6e5972d88a06e0b12336 (patch)
tree1ce4cf5e6bb063228807397b8e1462437eeef26f
parentSupport arm libraries with DT_TEXTREL, has no affect for other libraries. (diff)
downloadwireguard-openbsd-ebc1e070275751cd967c6e5972d88a06e0b12336.tar.xz
wireguard-openbsd-ebc1e070275751cd967c6e5972d88a06e0b12336.zip
- fall back to 1Mbps if tx rate is returned as zero. avoids divide by zero. should never happen, but sometimes it does on my amd64.
ok damien@
-rw-r--r--sys/dev/usb/if_ral.c4
-rw-r--r--sys/dev/usb/if_rum.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/usb/if_ral.c b/sys/dev/usb/if_ral.c
index ca6ac137957..8c8eea11bfb 100644
--- a/sys/dev/usb/if_ral.c
+++ b/sys/dev/usb/if_ral.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ral.c,v 1.77 2006/08/23 16:25:07 damien Exp $ */
+/* $OpenBSD: if_ral.c,v 1.78 2006/08/23 21:37:04 niallo Exp $ */
/*-
* Copyright (c) 2005, 2006
@@ -1116,6 +1116,8 @@ ural_tx_data(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
rate = ni->ni_rates.rs_rates[ni->ni_txrate];
}
rate &= IEEE80211_RATE_VAL;
+ if (rate == 0)
+ rate = 2; /* fallback to 1Mbps; should not happen */
data = &sc->tx_data[0];
desc = (struct ural_tx_desc *)data->buf;
diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c
index 2983e1be1b3..bb9aa48cbec 100644
--- a/sys/dev/usb/if_rum.c
+++ b/sys/dev/usb/if_rum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_rum.c,v 1.37 2006/08/23 16:25:07 damien Exp $ */
+/* $OpenBSD: if_rum.c,v 1.38 2006/08/23 21:37:04 niallo Exp $ */
/*-
* Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr>
@@ -1081,6 +1081,8 @@ rum_tx_data(struct rum_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
rate = ni->ni_rates.rs_rates[ni->ni_txrate];
}
rate &= IEEE80211_RATE_VAL;
+ if (rate == 0)
+ rate = 2; /* fallback to 1Mbps; should not happen */
data = &sc->tx_data[0];
desc = (struct rum_tx_desc *)data->buf;