Date: Thu, 5 Mar 2009 19:40:26 GMT From: Paul <onemda@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/132342: incorrect number used in for loop; fix TXPMGT reporting Message-ID: <200903051940.n25JeQ3O015572@www.freebsd.org> Resent-Message-ID: <200903051950.n25Jo1jD020964@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 132342 >Category: kern >Synopsis: incorrect number used in for loop; fix TXPMGT reporting >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Mar 05 19:50:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Paul >Release: 8.0 CURRENT >Organization: >Environment: FreeBSD 8.0-CURRENT FreeBSD 8.0-CURRENT #11 r189300: Tue Mar 3 11:47:21 UTC 2009 root@dhcppc1:/usr/obj/usr/src/sys/kernel i386 >Description: Correct size calculation for dBm2mW conversion table in for loop. Do not claim ndis miniport driver support TXPMGT if it doesnt(available via OID_802_11_TX_POWER_LEVEL). >How-To-Repeat: >Fix: --- /usr/src/sys/dev/if_ndis/if_ndis.c 2009-02-24 03:59:51.000000000 +0000 +++ if_ndis.c 2009-03-05 19:24:58.000000000 +0000 @@ -750,7 +750,7 @@ ic->ic_ifp = ifp; ic->ic_opmode = IEEE80211_M_STA; ic->ic_phytype = IEEE80211_T_DS; - ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_IBSS | IEEE80211_C_TXPMGT; + ic->ic_caps = IEEE80211_C_STA | IEEE80211_C_IBSS; setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO); len = 0; r = ndis_get_info(sc, OID_802_11_NETWORK_TYPES_SUPPORTED, @@ -929,6 +929,9 @@ r = ndis_get_info(sc, OID_802_11_POWER_MODE, &arg, &i); if (r == 0) ic->ic_caps |= IEEE80211_C_PMGT; + r = ndis_get_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &i); + if (r == 0) + ic->ic_caps |= IEEE80211_C_TXPMGT; bcopy(eaddr, &ic->ic_myaddr, sizeof(eaddr)); ieee80211_ifattach(ic); ic->ic_raw_xmit = ndis_raw_xmit; @@ -2324,7 +2327,8 @@ ndis_set_info(sc, OID_802_11_POWER_MODE, &arg, &len); /* Set TX power */ - if (ic->ic_txpowlimit < sizeof(dBm2mW)) { + if ((ic->ic_caps & IEEE80211_C_TXPMGT) && + (ic->ic_txpowlimit < sizeof(dBm2mW)/sizeof(dBm2mW[0]))) { len = sizeof(arg); arg = dBm2mW[ic->ic_txpowlimit]; ndis_set_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &len); @@ -2797,11 +2801,10 @@ } /* Get TX power */ - len = sizeof(arg); - rval = ndis_get_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &len); - - if (!rval) { - for (i = 0; i < sizeof(dBm2mW); i++) + if (ic->ic_caps & IEEE80211_C_TXPMGT) { + len = sizeof(arg); + ndis_get_info(sc, OID_802_11_TX_POWER_LEVEL, &arg, &len); + for (i = 0; i < sizeof(dBm2mW)/sizeof(dBm2mW[0]); i++) if (dBm2mW[i] >= arg) break; ic->ic_txpowlimit = i; >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903051940.n25JeQ3O015572>