aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/key.c')
-rw-r--r--net/mac80211/key.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 6ff65a1ebaa9..16d97f044a20 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -325,7 +325,8 @@ ieee80211_key_alloc(u32 cipher, int idx, size_t key_len,
325 struct ieee80211_key *key; 325 struct ieee80211_key *key;
326 int i, j, err; 326 int i, j, err;
327 327
328 BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS); 328 if (WARN_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS))
329 return ERR_PTR(-EINVAL);
329 330
330 key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL); 331 key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL);
331 if (!key) 332 if (!key)
@@ -481,8 +482,8 @@ int ieee80211_key_link(struct ieee80211_key *key,
481 int idx, ret; 482 int idx, ret;
482 bool pairwise; 483 bool pairwise;
483 484
484 BUG_ON(!sdata); 485 if (WARN_ON(!sdata || !key))
485 BUG_ON(!key); 486 return -EINVAL;
486 487
487 pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; 488 pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE;
488 idx = key->conf.keyidx; 489 idx = key->conf.keyidx;