提交 2610c733 编写于 作者: J Javier Achirica 提交者: Jeff Garzik

airo: Off-by-one channel fix

上级 38bd3b26
...@@ -5668,13 +5668,13 @@ static int airo_set_freq(struct net_device *dev, ...@@ -5668,13 +5668,13 @@ static int airo_set_freq(struct net_device *dev,
int channel = fwrq->m; int channel = fwrq->m;
/* We should do a better check than that, /* We should do a better check than that,
* based on the card capability !!! */ * based on the card capability !!! */
if((channel < 1) || (channel > 16)) { if((channel < 1) || (channel > 14)) {
printk(KERN_DEBUG "%s: New channel value of %d is invalid!\n", dev->name, fwrq->m); printk(KERN_DEBUG "%s: New channel value of %d is invalid!\n", dev->name, fwrq->m);
rc = -EINVAL; rc = -EINVAL;
} else { } else {
readConfigRid(local, 1); readConfigRid(local, 1);
/* Yes ! We can set it !!! */ /* Yes ! We can set it !!! */
local->config.channelSet = (u16)(channel - 1); local->config.channelSet = (u16) channel;
set_bit (FLAG_COMMIT, &local->flags); set_bit (FLAG_COMMIT, &local->flags);
} }
} }
...@@ -5692,6 +5692,7 @@ static int airo_get_freq(struct net_device *dev, ...@@ -5692,6 +5692,7 @@ static int airo_get_freq(struct net_device *dev,
{ {
struct airo_info *local = dev->priv; struct airo_info *local = dev->priv;
StatusRid status_rid; /* Card status info */ StatusRid status_rid; /* Card status info */
int ch;
readConfigRid(local, 1); readConfigRid(local, 1);
if ((local->config.opmode & 0xFF) == MODE_STA_ESS) if ((local->config.opmode & 0xFF) == MODE_STA_ESS)
...@@ -5699,16 +5700,14 @@ static int airo_get_freq(struct net_device *dev, ...@@ -5699,16 +5700,14 @@ static int airo_get_freq(struct net_device *dev,
else else
readStatusRid(local, &status_rid, 1); readStatusRid(local, &status_rid, 1);
#ifdef WEXT_USECHANNELS ch = (int)status_rid.channel;
fwrq->m = ((int)status_rid.channel) + 1; if((ch > 0) && (ch < 15)) {
fwrq->e = 0; fwrq->m = frequency_list[ch - 1] * 100000;
#else
{
int f = (int)status_rid.channel;
fwrq->m = frequency_list[f] * 100000;
fwrq->e = 1; fwrq->e = 1;
} else {
fwrq->m = ch;
fwrq->e = 0;
} }
#endif
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册