airo: return from set_wep_key() when key length is zero
authorStanislaw Gruszka <sgruszka@redhat.com>
Fri, 26 Feb 2010 14:10:28 +0000 (15:10 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 2 Mar 2010 19:28:48 +0000 (14:28 -0500)
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>
drivers/net/wireless/airo.c

index 698d5672a070e785d1c090eb39947b89acf0d7d5..dc5018a6d9edcc75a9de752c56e1f27bdbd2d7ee 100644 (file)
@@ -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));