diff options
Diffstat (limited to 'drivers/net/wireless/airo.c')
| -rw-r--r-- | drivers/net/wireless/airo.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index c36d3a3d655f..9eabf4d1f2e7 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
| @@ -6467,6 +6467,7 @@ static int airo_get_encode(struct net_device *dev, | |||
| 6467 | { | 6467 | { |
| 6468 | struct airo_info *local = dev->ml_priv; | 6468 | struct airo_info *local = dev->ml_priv; |
| 6469 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; | 6469 | int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; |
| 6470 | int wep_key_len; | ||
| 6470 | u8 buf[16]; | 6471 | u8 buf[16]; |
| 6471 | 6472 | ||
| 6472 | if (!local->wep_capable) | 6473 | if (!local->wep_capable) |
| @@ -6500,8 +6501,13 @@ static int airo_get_encode(struct net_device *dev, | |||
| 6500 | dwrq->flags |= index + 1; | 6501 | dwrq->flags |= index + 1; |
| 6501 | 6502 | ||
| 6502 | /* Copy the key to the user buffer */ | 6503 | /* Copy the key to the user buffer */ |
| 6503 | dwrq->length = get_wep_key(local, index, &buf[0], sizeof(buf)); | 6504 | wep_key_len = get_wep_key(local, index, &buf[0], sizeof(buf)); |
| 6504 | memcpy(extra, buf, dwrq->length); | 6505 | if (wep_key_len < 0) { |
| 6506 | dwrq->length = 0; | ||
| 6507 | } else { | ||
| 6508 | dwrq->length = wep_key_len; | ||
| 6509 | memcpy(extra, buf, dwrq->length); | ||
| 6510 | } | ||
| 6505 | 6511 | ||
| 6506 | return 0; | 6512 | return 0; |
| 6507 | } | 6513 | } |
| @@ -6614,7 +6620,7 @@ static int airo_get_encodeext(struct net_device *dev, | |||
| 6614 | struct airo_info *local = dev->ml_priv; | 6620 | struct airo_info *local = dev->ml_priv; |
| 6615 | struct iw_point *encoding = &wrqu->encoding; | 6621 | struct iw_point *encoding = &wrqu->encoding; |
| 6616 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | 6622 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; |
| 6617 | int idx, max_key_len; | 6623 | int idx, max_key_len, wep_key_len; |
| 6618 | u8 buf[16]; | 6624 | u8 buf[16]; |
| 6619 | 6625 | ||
| 6620 | if (!local->wep_capable) | 6626 | if (!local->wep_capable) |
| @@ -6658,8 +6664,13 @@ static int airo_get_encodeext(struct net_device *dev, | |||
| 6658 | memset(extra, 0, 16); | 6664 | memset(extra, 0, 16); |
| 6659 | 6665 | ||
| 6660 | /* Copy the key to the user buffer */ | 6666 | /* Copy the key to the user buffer */ |
| 6661 | ext->key_len = get_wep_key(local, idx, &buf[0], sizeof(buf)); | 6667 | wep_key_len = get_wep_key(local, idx, &buf[0], sizeof(buf)); |
| 6662 | memcpy(extra, buf, ext->key_len); | 6668 | if (wep_key_len < 0) { |
| 6669 | ext->key_len = 0; | ||
| 6670 | } else { | ||
| 6671 | ext->key_len = wep_key_len; | ||
| 6672 | memcpy(extra, buf, ext->key_len); | ||
| 6673 | } | ||
| 6663 | 6674 | ||
| 6664 | return 0; | 6675 | return 0; |
| 6665 | } | 6676 | } |
