Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jul 2014 21:59:24 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r269266 - stable/10/sys/dev/usb/wlan
Message-ID:  <201407292159.s6TLxO7h086966@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Tue Jul 29 21:59:24 2014
New Revision: 269266
URL: http://svnweb.freebsd.org/changeset/base/269266

Log:
  MFC r269127:
  Fix for division by zero.

Modified:
  stable/10/sys/dev/usb/wlan/if_rum.c
  stable/10/sys/dev/usb/wlan/if_ural.c
  stable/10/sys/dev/usb/wlan/if_zyd.c
  stable/10/sys/dev/usb/wlan/if_zydreg.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- stable/10/sys/dev/usb/wlan/if_rum.c	Tue Jul 29 21:38:06 2014	(r269265)
+++ stable/10/sys/dev/usb/wlan/if_rum.c	Tue Jul 29 21:59:24 2014	(r269266)
@@ -1034,6 +1034,8 @@ rum_setup_tx_desc(struct rum_softc *sc, 
 		desc->plcp_length_hi = plcp_length >> 6;
 		desc->plcp_length_lo = plcp_length & 0x3f;
 	} else {
+		if (rate == 0)
+			rate = 2;	/* avoid division by zero */
 		plcp_length = (16 * len + rate - 1) / rate;
 		if (rate == 22) {
 			remainder = (16 * len) % 22;

Modified: stable/10/sys/dev/usb/wlan/if_ural.c
==============================================================================
--- stable/10/sys/dev/usb/wlan/if_ural.c	Tue Jul 29 21:38:06 2014	(r269265)
+++ stable/10/sys/dev/usb/wlan/if_ural.c	Tue Jul 29 21:59:24 2014	(r269266)
@@ -1037,6 +1037,8 @@ ural_setup_tx_desc(struct ural_softc *sc
 		desc->plcp_length_hi = plcp_length >> 6;
 		desc->plcp_length_lo = plcp_length & 0x3f;
 	} else {
+		if (rate == 0)
+			rate = 2;	/* avoid division by zero */
 		plcp_length = (16 * len + rate - 1) / rate;
 		if (rate == 22) {
 			remainder = (16 * len) % 22;

Modified: stable/10/sys/dev/usb/wlan/if_zyd.c
==============================================================================
--- stable/10/sys/dev/usb/wlan/if_zyd.c	Tue Jul 29 21:38:06 2014	(r269265)
+++ stable/10/sys/dev/usb/wlan/if_zyd.c	Tue Jul 29 21:59:24 2014	(r269266)
@@ -2479,7 +2479,7 @@ zyd_tx_start(struct zyd_softc *sc, struc
 	const struct ieee80211_txparam *tp;
 	struct ieee80211_key *k;
 	int rate, totlen;
-	static uint8_t ratediv[] = ZYD_TX_RATEDIV;
+	static const uint8_t ratediv[] = ZYD_TX_RATEDIV;
 	uint8_t phy;
 	uint16_t pktlen;
 	uint32_t bits;

Modified: stable/10/sys/dev/usb/wlan/if_zydreg.h
==============================================================================
--- stable/10/sys/dev/usb/wlan/if_zydreg.h	Tue Jul 29 21:38:06 2014	(r269265)
+++ stable/10/sys/dev/usb/wlan/if_zydreg.h	Tue Jul 29 21:59:24 2014	(r269266)
@@ -970,7 +970,7 @@
 
 #define	ZYD_TX_RATEDIV							\
 {									\
-	0x1, 0x2, 0xb, 0xb, 0x0, 0x0, 0x0, 0x0, 0x30, 0x18, 0xc, 0x6,	\
+	0x1, 0x2, 0xb, 0xb, 0x1, 0x1, 0x1, 0x1, 0x30, 0x18, 0xc, 0x6,	\
 	0x36, 0x24, 0x12, 0x9						\
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407292159.s6TLxO7h086966>