FreeBSD Bugzilla – Attachment 155332 Details for
Bug 197143
[wpi] [patch]: sync with iwn / OpenBSD wpi
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix buffer overflow (unbreaks 802.11a capable NICs)
patch-wpi71.diff (text/plain), 3.15 KB, created by
Andriy Voskoboinyk
on 2015-04-08 06:41:32 UTC
(
hide
)
Description:
Fix buffer overflow (unbreaks 802.11a capable NICs)
Filename:
MIME Type:
Creator:
Andriy Voskoboinyk
Created:
2015-04-08 06:41:32 UTC
Size:
3.15 KB
patch
obsolete
>Index: sys/dev/wpi/if_wpi.c >=================================================================== >--- sys/dev/wpi/if_wpi.c (revision 280264) >+++ sys/dev/wpi/if_wpi.c (working copy) >@@ -218,7 +218,7 @@ > static void wpi_power_calibration(struct wpi_softc *); > static int wpi_set_txpower(struct wpi_softc *, int); > static int wpi_get_power_index(struct wpi_softc *, >- struct wpi_power_group *, struct ieee80211_channel *, int); >+ struct wpi_power_group *, uint8_t, int, int); > static int wpi_set_pslevel(struct wpi_softc *, uint8_t, int, int); > static int wpi_send_btcoex(struct wpi_softc *); > static int wpi_send_rxon(struct wpi_softc *, int, int); >@@ -3455,19 +3455,17 @@ > static int > wpi_set_txpower(struct wpi_softc *sc, int async) > { >- struct ieee80211com *ic = sc->sc_ifp->if_l2com; >- struct ieee80211_channel *ch; > struct wpi_power_group *group; > struct wpi_cmd_txpower cmd; > uint8_t chan; >- int idx, i; >+ int idx, is_chan_5ghz, i; > > /* Retrieve current channel from last RXON. */ > chan = sc->rxon.chan; >- ch = &ic->ic_channels[chan]; >+ is_chan_5ghz = (sc->rxon.flags & htole32(WPI_RXON_24GHZ)) == 0; > > /* Find the TX power group to which this channel belongs. */ >- if (IEEE80211_IS_CHAN_5GHZ(ch)) { >+ if (is_chan_5ghz) { > for (group = &sc->groups[1]; group < &sc->groups[4]; group++) > if (chan <= group->chan) > break; >@@ -3475,17 +3473,17 @@ > group = &sc->groups[0]; > > memset(&cmd, 0, sizeof cmd); >- cmd.band = IEEE80211_IS_CHAN_5GHZ(ch) ? 0 : 1; >+ cmd.band = is_chan_5ghz ? WPI_BAND_5GHZ : WPI_BAND_2GHZ; > cmd.chan = htole16(chan); > > /* Set TX power for all OFDM and CCK rates. */ > for (i = 0; i <= WPI_RIDX_MAX ; i++) { > /* Retrieve TX power for this channel/rate. */ >- idx = wpi_get_power_index(sc, group, ch, i); >+ idx = wpi_get_power_index(sc, group, chan, is_chan_5ghz, i); > > cmd.rates[i].plcp = wpi_ridx_to_plcp[i]; > >- if (IEEE80211_IS_CHAN_5GHZ(ch)) { >+ if (is_chan_5ghz) { > cmd.rates[i].rf_gain = wpi_rf_gain_5ghz[idx]; > cmd.rates[i].dsp_gain = wpi_dsp_gain_5ghz[idx]; > } else { >@@ -3506,7 +3504,7 @@ > */ > static int > wpi_get_power_index(struct wpi_softc *sc, struct wpi_power_group *group, >- struct ieee80211_channel *c, int ridx) >+ uint8_t chan, int is_chan_5ghz, int ridx) > { > /* Fixed-point arithmetic division using a n-bit fractional part. */ > #define fdivround(a, b, n) \ >@@ -3516,14 +3514,9 @@ > #define interpolate(x, x1, y1, x2, y2, n) \ > ((y1) + fdivround(((x) - (x1)) * ((y2) - (y1)), (x2) - (x1), n)) > >- struct ieee80211com *ic = sc->sc_ifp->if_l2com; > struct wpi_power_sample *sample; > int pwr, idx; >- u_int chan; > >- /* Get channel number. */ >- chan = ieee80211_chan2ieee(ic, c); >- > /* Default TX power is group maximum TX power minus 3dB. */ > pwr = group->maxpwr / 2; > >@@ -3530,13 +3523,13 @@ > /* Decrease TX power for highest OFDM rates to reduce distortion. */ > switch (ridx) { > case WPI_RIDX_OFDM36: >- pwr -= IEEE80211_IS_CHAN_2GHZ(c) ? 0 : 5; >+ pwr -= is_chan_5ghz ? 5 : 0; > break; > case WPI_RIDX_OFDM48: >- pwr -= IEEE80211_IS_CHAN_2GHZ(c) ? 7 : 10; >+ pwr -= is_chan_5ghz ? 10 : 7; > break; > case WPI_RIDX_OFDM54: >- pwr -= IEEE80211_IS_CHAN_2GHZ(c) ? 9 : 12; >+ pwr -= is_chan_5ghz ? 12 : 9; > break; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 197143
:
152282
|
152662
|
152977
|
153911
|
153977
|
153983
|
153985
|
153999
|
154000
|
154002
|
154006
|
154007
|
154009
|
154010
|
154011
|
154013
|
154015
|
154016
|
154017
|
154019
|
154020
|
154021
|
154022
|
154024
|
154026
|
154030
|
154032
|
154033
|
154328
|
154329
|
154330
|
154332
|
154334
|
154335
|
154336
|
154337
|
154338
|
154340
|
154341
|
154343
|
154346
|
154347
|
154348
|
154349
|
154350
|
154351
|
154352
|
154353
|
154354
|
154355
|
154356
|
154357
|
154358
|
154359
|
154360
|
154361
|
154362
|
154363
|
154364
|
154365
|
154366
|
154368
|
154369
|
154370
|
154371
|
154372
|
154373
|
154374
|
154375
|
154378
|
154379
|
154380
|
154381
|
154382
|
154383
|
154384
| 155332 |
155333
|
156164
|
156165
|
156166
|
156167
|
156168
|
156169
|
156170
|
156171
|
156172
|
156173
|
156174
|
156175
|
156176
|
156177
|
156178
|
156179
|
156180
|
156181
|
156182
|
156183
|
156184
|
156185
|
156186
|
156187
|
156188
|
156189
|
156190
|
156191
|
156192
|
156193
|
156194
|
156195