Skip to content

Commit

Permalink
airo: return from set_wep_key() when key length is zero
Browse files Browse the repository at this point in the history
Even if keylen == 0 is a bug and should not really happen, better avoid
possibility of passing bad value to firmware.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Stanislaw Gruszka authored and John W. Linville committed Mar 2, 2010
1 parent 2507c05 commit 6510b89
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/wireless/airo.c
Original file line number Diff line number Diff line change
Expand Up @@ -5255,7 +5255,8 @@ static int set_wep_key(struct airo_info *ai, u16 index, const char *key,
WepKeyRid wkr;
int rc;

WARN_ON(keylen == 0);
if (WARN_ON(keylen == 0))
return -1;

memset(&wkr, 0, sizeof(wkr));
wkr.len = cpu_to_le16(sizeof(wkr));
Expand Down

0 comments on commit 6510b89

Please sign in to comment.