orinoco: Fix walking past the end of the buffer

Fix walking past the end of the bitrate_table array
in the case when the loop counter == BITRATE_TABLE_SIZE.

Reported by: Denis Kirjanov <dkirjanov@kernel.org>
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
David Kilroy
2010-08-21 12:08:15 +01:00
committed by John W. Linville
parent 0fb9a9ec27
commit 9736ebfe39
2 changed files with 15 additions and 5 deletions

View File

@@ -589,8 +589,15 @@ static int orinoco_ioctl_getrate(struct net_device *dev,
/* If the interface is running we try to find more about the
current mode */
if (netif_running(dev))
err = orinoco_hw_get_act_bitrate(priv, &bitrate);
if (netif_running(dev)) {
int act_bitrate;
int lerr;
/* Ignore errors if we can't get the actual bitrate */
lerr = orinoco_hw_get_act_bitrate(priv, &act_bitrate);
if (!lerr)
bitrate = act_bitrate;
}
orinoco_unlock(priv, &flags);