Project

General

Profile

Actions

Bug #9418

closed

iwn: rate array in struct iwn_ks_txpower should have size IWN_RIDX_MAX+1

Added by Toomas Soome over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
driver - device drivers
Start date:
2018-03-28
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:

Description

Work from Richard Lowe.

--- a/usr/src/uts/common/io/iwn/if_iwnvar.h
+++ b/usr/src/uts/common/io/iwn/if_iwnvar.h
@@ -400,7 +400,7 @@ struct iwn_ks_txpower {
                struct {
                        kstat_named_t   rf_gain;
                        kstat_named_t   dsp_gain;
-               } rate[IWN_RIDX_MAX];
+               } rate[IWN_RIDX_MAX + 1];
        } txchain[2];
 };

Apparently the IWN_RIDX_MAX (32) is not the max number of rates, but last valid index, hence the code we have and also freebsd and netbsd are having loops like:

for (ridx = 0; ridx <= IWN_RIDX_MAX; ridx++)

There is also comment: http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/io/iwn/if_iwn.c#4661

telling us: Set TX power for current channel (each rate has its own power settings).

From this hint, we can conclude that we would need an array for power stats with size IWN_RIDX_MAX + 1, note the same is done in struct iwn4965_cmd_txpower (http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/io/iwn/if_iwnreg.h#882).

Actions #1

Updated by Marcel Telka over 5 years ago

  • Description updated (diff)
Actions #2

Updated by Toomas Soome over 5 years ago

  • Subject changed from iwn: hold our noses and size an array MAX+1, as seems to be done here to iwn:rate array in struct iwn_ks_txpower should have size IWN_RIDX_MAX+1
  • Description updated (diff)
Actions #3

Updated by Toomas Soome over 5 years ago

  • Subject changed from iwn:rate array in struct iwn_ks_txpower should have size IWN_RIDX_MAX+1 to iwn: rate array in struct iwn_ks_txpower should have size IWN_RIDX_MAX+1
Actions #4

Updated by Electric Monk over 5 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 843ead088f87e5e766084646370e981f176eb323

commit  843ead088f87e5e766084646370e981f176eb323
Author: Richard Lowe <richlowe@richlowe.net>
Date:   2018-08-16T19:40:18.000Z

    9418 iwn: rate array in struct iwn_ks_txpower should have size IWN_RIDX_MAX+1
    Reviewed by: Marcel Telka <marcel@telka.sk>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF