Index: head/sys/dev/bwi/if_bwi.c =================================================================== --- head/sys/dev/bwi/if_bwi.c +++ head/sys/dev/bwi/if_bwi.c @@ -356,8 +356,8 @@ device_t dev = sc->sc_dev; struct bwi_mac *mac; struct bwi_phy *phy; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; int i, error; - uint8_t bands; BWI_LOCK_INIT(sc); @@ -453,15 +453,15 @@ /* * Setup ratesets, phytype, channels and get MAC address */ - bands = 0; + memset(bands, 0, sizeof(bands)); if (phy->phy_mode == IEEE80211_MODE_11B || phy->phy_mode == IEEE80211_MODE_11G) { - setbit(&bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11B); if (phy->phy_mode == IEEE80211_MODE_11B) { ic->ic_phytype = IEEE80211_T_DS; } else { ic->ic_phytype = IEEE80211_T_OFDM; - setbit(&bands, IEEE80211_MODE_11G); + setbit(bands, IEEE80211_MODE_11G); } bwi_get_eaddr(sc, BWI_SPROM_11BG_EADDR, ic->ic_macaddr); @@ -475,7 +475,7 @@ } } else if (phy->phy_mode == IEEE80211_MODE_11A) { /* TODO:11A */ - setbit(&bands, IEEE80211_MODE_11A); + setbit(bands, IEEE80211_MODE_11A); error = ENXIO; goto fail; } else { @@ -487,7 +487,7 @@ BWI_SPROM_CARD_INFO_LOCALE); DPRINTF(sc, BWI_DBG_ATTACH, "locale: %d\n", sc->sc_locale); /* XXX use locale */ - ieee80211_init_channels(ic, NULL, &bands); + ieee80211_init_channels(ic, NULL, bands); ic->ic_softc = sc; ic->ic_name = device_get_nameunit(dev); Index: head/sys/dev/if_ndis/if_ndis.c =================================================================== --- head/sys/dev/if_ndis/if_ndis.c +++ head/sys/dev/if_ndis/if_ndis.c @@ -724,8 +724,8 @@ ndis_80211_rates_ex rates; struct ndis_80211_nettype_list *ntl; uint32_t arg; - int mode, i, r, len; - uint8_t bands = 0; + int mode, i, r, len, nonettypes = 1; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)] = { 0 }; callout_init(&sc->ndis_scan_callout, 1); @@ -751,8 +751,9 @@ for (i = 0; i < ntl->ntl_items; i++) { mode = ndis_nettype_mode(ntl->ntl_type[i]); if (mode) { + nonettypes = 0; setbit(ic->ic_modecaps, mode); - setbit(&bands, mode); + setbit(bands, mode); } else device_printf(sc->ndis_dev, "Unknown nettype %d\n", ntl->ntl_type[i]); @@ -760,9 +761,9 @@ free(ntl, M_DEVBUF); nonettypes: /* Default to 11b channels if the card did not supply any */ - if (bands == 0) { + if (nonettypes) { setbit(ic->ic_modecaps, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11B); } len = sizeof(rates); bzero((char *)&rates, len); @@ -859,7 +860,7 @@ #undef INCRATE #undef TESTSETRATE - ieee80211_init_channels(ic, NULL, &bands); + ieee80211_init_channels(ic, NULL, bands); /* * To test for WPA support, we need to see if we can Index: head/sys/dev/iwi/if_iwi.c =================================================================== --- head/sys/dev/iwi/if_iwi.c +++ head/sys/dev/iwi/if_iwi.c @@ -271,8 +271,8 @@ struct iwi_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; uint16_t val; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; int i, error; - uint8_t bands; sc->sc_dev = dev; @@ -373,13 +373,13 @@ val = iwi_read_prom_word(sc, IWI_EEPROM_MAC + 2); ic->ic_macaddr[4] = val & 0xff; ic->ic_macaddr[5] = val >> 8; - - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); if (pci_get_device(dev) >= 0x4223) - setbit(&bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, &bands); + setbit(bands, IEEE80211_MODE_11A); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); /* override default methods */ Index: head/sys/dev/malo/if_malo.c =================================================================== --- head/sys/dev/malo/if_malo.c +++ head/sys/dev/malo/if_malo.c @@ -173,7 +173,7 @@ struct ieee80211com *ic = &sc->malo_ic; struct malo_hal *mh; int error; - uint8_t bands; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; MALO_LOCK_INIT(sc); callout_init_mtx(&sc->malo_watchdog_timer, &sc->malo_mtx, 0); @@ -222,10 +222,10 @@ sc->malo_hwspecs.wcbbase[2], sc->malo_hwspecs.wcbbase[3]); /* NB: firmware looks that it does not export regdomain info API. */ - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); - ieee80211_init_channels(ic, NULL, &bands); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, bands); sc->malo_txantenna = 0x2; /* h/w default */ sc->malo_rxantenna = 0xffff; /* h/w default */ Index: head/sys/dev/otus/if_otus.c =================================================================== --- head/sys/dev/otus/if_otus.c +++ head/sys/dev/otus/if_otus.c @@ -624,8 +624,8 @@ struct ieee80211com *ic = &sc->sc_ic; usb_device_request_t req; uint32_t in, out; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; int error; - uint8_t bands; /* Not locked */ error = otus_load_firmware(sc, "otusfw_init", AR_FW_INIT_ADDR); @@ -743,19 +743,19 @@ otus_get_chanlist(sc); #else /* Set supported .11b and .11g rates. */ - bands = 0; + memset(bands, 0, sizeof(bands)); if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11G) { - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); } if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11A) { - setbit(&bands, IEEE80211_MODE_11A); + setbit(bands, IEEE80211_MODE_11A); } #if 0 if (sc->sc_ht) - setbit(&bands, IEEE80211_MODE_11NG); + setbit(bands, IEEE80211_MODE_11NG); #endif - ieee80211_init_channels(ic, NULL, &bands); + ieee80211_init_channels(ic, NULL, bands); #endif ieee80211_ifattach(ic); Index: head/sys/dev/ral/rt2560.c =================================================================== --- head/sys/dev/ral/rt2560.c +++ head/sys/dev/ral/rt2560.c @@ -199,7 +199,7 @@ { struct rt2560_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; - uint8_t bands; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; int error; sc->sc_dev = dev; @@ -278,12 +278,12 @@ #endif ; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); if (sc->rf_rev == RT2560_RF_5222) - setbit(&bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, &bands); + setbit(bands, IEEE80211_MODE_11A); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); ic->ic_raw_xmit = rt2560_raw_xmit; Index: head/sys/dev/ral/rt2661.c =================================================================== --- head/sys/dev/ral/rt2661.c +++ head/sys/dev/ral/rt2661.c @@ -199,8 +199,8 @@ struct rt2661_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; uint32_t val; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; int error, ac, ntries; - uint8_t bands; sc->sc_id = id; sc->sc_dev = dev; @@ -279,12 +279,12 @@ #endif ; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); if (sc->rf_rev == RT2661_RF_5225 || sc->rf_rev == RT2661_RF_5325) - setbit(&bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, &bands); + setbit(bands, IEEE80211_MODE_11A); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); #if 0 Index: head/sys/dev/ral/rt2860.c =================================================================== --- head/sys/dev/ral/rt2860.c +++ head/sys/dev/ral/rt2860.c @@ -232,8 +232,8 @@ struct rt2860_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; uint32_t tmp; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; int error, ntries, qid; - uint8_t bands; sc->sc_dev = dev; sc->sc_debug = 0; @@ -319,12 +319,12 @@ | IEEE80211_C_WME /* 802.11e */ ; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850) - setbit(&bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, &bands); + setbit(bands, IEEE80211_MODE_11A); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); Index: head/sys/dev/rtwn/if_rtwn.c =================================================================== --- head/sys/dev/rtwn/if_rtwn.c +++ head/sys/dev/rtwn/if_rtwn.c @@ -251,7 +251,7 @@ struct rtwn_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; uint32_t lcsr; - uint8_t bands; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; int i, count, error, rid; sc->sc_dev = dev; @@ -353,10 +353,10 @@ | IEEE80211_C_WME /* 802.11e */ ; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); - ieee80211_init_channels(ic, NULL, &bands); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); Index: head/sys/dev/usb/wlan/if_rsu.c =================================================================== --- head/sys/dev/usb/wlan/if_rsu.c +++ head/sys/dev/usb/wlan/if_rsu.c @@ -403,7 +403,8 @@ struct rsu_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; int error; - uint8_t iface_index, bands; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; + uint8_t iface_index; struct usb_interface *iface; const char *rft; @@ -531,12 +532,12 @@ } /* Set supported .11b and .11g rates. */ - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); if (sc->sc_ht) - setbit(&bands, IEEE80211_MODE_11NG); - ieee80211_init_channels(ic, NULL, &bands); + setbit(bands, IEEE80211_MODE_11NG); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); ic->ic_raw_xmit = rsu_raw_xmit; Index: head/sys/dev/usb/wlan/if_rum.c =================================================================== --- head/sys/dev/usb/wlan/if_rum.c +++ head/sys/dev/usb/wlan/if_rum.c @@ -468,8 +468,9 @@ struct usb_attach_arg *uaa = device_get_ivars(self); struct rum_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; - uint8_t iface_index, bands; uint32_t tmp; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; + uint8_t iface_index; int error, ntries; device_set_usb_desc(self); @@ -537,12 +538,12 @@ IEEE80211_CRYPTO_TKIPMIC | IEEE80211_CRYPTO_TKIP; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); if (sc->rf_rev == RT2573_RF_5225 || sc->rf_rev == RT2573_RF_5226) - setbit(&bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, &bands); + setbit(bands, IEEE80211_MODE_11A); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); ic->ic_update_promisc = rum_update_promisc; Index: head/sys/dev/usb/wlan/if_run.c =================================================================== --- head/sys/dev/usb/wlan/if_run.c +++ head/sys/dev/usb/wlan/if_run.c @@ -704,8 +704,9 @@ struct usb_attach_arg *uaa = device_get_ivars(self); struct ieee80211com *ic = &sc->sc_ic; uint32_t ver; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; + uint8_t iface_index; int ntries, error; - uint8_t iface_index, bands; device_set_usb_desc(self); sc->sc_udev = uaa->device; @@ -785,14 +786,14 @@ ic->ic_flags |= IEEE80211_F_DATAPAD; ic->ic_flags_ext |= IEEE80211_FEXT_SWBMISS; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 || sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 || sc->rf_rev == RT5592_RF_5592) - setbit(&bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, &bands); + setbit(bands, IEEE80211_MODE_11A); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); Index: head/sys/dev/usb/wlan/if_uath.c =================================================================== --- head/sys/dev/usb/wlan/if_uath.c +++ head/sys/dev/usb/wlan/if_uath.c @@ -328,7 +328,8 @@ struct uath_softc *sc = device_get_softc(dev); struct usb_attach_arg *uaa = device_get_ivars(dev); struct ieee80211com *ic = &sc->sc_ic; - uint8_t bands, iface_index = UATH_IFACE_INDEX; /* XXX */ + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; + uint8_t iface_index = UATH_IFACE_INDEX; /* XXX */ usb_error_t error; sc->sc_dev = dev; @@ -431,13 +432,13 @@ /* put a regulatory domain to reveal informations. */ uath_regdomain = sc->sc_devcap.regDomain; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); if ((sc->sc_devcap.analog5GhzRevision & 0xf0) == 0x30) - setbit(&bands, IEEE80211_MODE_11A); + setbit(bands, IEEE80211_MODE_11A); /* XXX turbo */ - ieee80211_init_channels(ic, NULL, &bands); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); ic->ic_raw_xmit = uath_raw_xmit; Index: head/sys/dev/usb/wlan/if_upgt.c =================================================================== --- head/sys/dev/usb/wlan/if_upgt.c +++ head/sys/dev/usb/wlan/if_upgt.c @@ -243,7 +243,8 @@ struct upgt_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; struct usb_attach_arg *uaa = device_get_ivars(dev); - uint8_t bands, iface_index = UPGT_IFACE_INDEX; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; + uint8_t iface_index = UPGT_IFACE_INDEX; int error; sc->sc_dev = dev; @@ -337,10 +338,10 @@ | IEEE80211_C_WPA /* 802.11i */ ; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); - ieee80211_init_channels(ic, NULL, &bands); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); ic->ic_raw_xmit = upgt_raw_xmit; Index: head/sys/dev/usb/wlan/if_ural.c =================================================================== --- head/sys/dev/usb/wlan/if_ural.c +++ head/sys/dev/usb/wlan/if_ural.c @@ -424,7 +424,8 @@ struct usb_attach_arg *uaa = device_get_ivars(self); struct ural_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; - uint8_t iface_index, bands; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; + uint8_t iface_index; int error; device_set_usb_desc(self); @@ -473,12 +474,12 @@ | IEEE80211_C_WPA /* 802.11i */ ; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); if (sc->rf_rev == RAL_RF_5222) - setbit(&bands, IEEE80211_MODE_11A); - ieee80211_init_channels(ic, NULL, &bands); + setbit(bands, IEEE80211_MODE_11A); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); ic->ic_update_promisc = ural_update_promisc; Index: head/sys/dev/usb/wlan/if_urtw.c =================================================================== --- head/sys/dev/usb/wlan/if_urtw.c +++ head/sys/dev/usb/wlan/if_urtw.c @@ -785,7 +785,8 @@ struct urtw_softc *sc = device_get_softc(dev); struct usb_attach_arg *uaa = device_get_ivars(dev); struct ieee80211com *ic = &sc->sc_ic; - uint8_t bands, iface_index = URTW_IFACE_INDEX; /* XXX */ + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; + uint8_t iface_index = URTW_IFACE_INDEX; /* XXX */ uint16_t n_setup; uint32_t data; usb_error_t error; @@ -876,10 +877,10 @@ IEEE80211_C_BGSCAN | /* capable of bg scanning */ IEEE80211_C_WPA; /* 802.11i */ - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); - ieee80211_init_channels(ic, NULL, &bands); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); ic->ic_raw_xmit = urtw_raw_xmit; Index: head/sys/dev/usb/wlan/if_urtwn.c =================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c +++ head/sys/dev/usb/wlan/if_urtwn.c @@ -439,7 +439,7 @@ struct usb_attach_arg *uaa = device_get_ivars(self); struct urtwn_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; - uint8_t bands; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; int error; device_set_usb_desc(self); @@ -525,10 +525,10 @@ IEEE80211_CRYPTO_TKIP | IEEE80211_CRYPTO_AES_CCM; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); - ieee80211_init_channels(ic, NULL, &bands); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); ic->ic_raw_xmit = urtwn_raw_xmit; Index: head/sys/dev/usb/wlan/if_zyd.c =================================================================== --- head/sys/dev/usb/wlan/if_zyd.c +++ head/sys/dev/usb/wlan/if_zyd.c @@ -334,7 +334,8 @@ struct usb_attach_arg *uaa = device_get_ivars(dev); struct zyd_softc *sc = device_get_softc(dev); struct ieee80211com *ic = &sc->sc_ic; - uint8_t iface_index, bands; + uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)]; + uint8_t iface_index; int error; if (uaa->info.bcdDevice < 0x4330) { @@ -387,10 +388,10 @@ | IEEE80211_C_WPA /* 802.11i */ ; - bands = 0; - setbit(&bands, IEEE80211_MODE_11B); - setbit(&bands, IEEE80211_MODE_11G); - ieee80211_init_channels(ic, NULL, &bands); + memset(bands, 0, sizeof(bands)); + setbit(bands, IEEE80211_MODE_11B); + setbit(bands, IEEE80211_MODE_11G); + ieee80211_init_channels(ic, NULL, bands); ieee80211_ifattach(ic); ic->ic_raw_xmit = zyd_raw_xmit;