forked from Minki/linux
staging: rtl8192u: remove redundant null check on array alg
u.crypt.alg is an array of u8 integers and hence the null check on this array is redundant and can be removed. Detected with CoverityScan, CID#143214 ("Array compared against 0") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7a976ce11e
commit
0840ff7690
@ -3056,23 +3056,21 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
|
||||
} else
|
||||
sec.flags &= ~SEC_ACTIVE_KEY;
|
||||
|
||||
if (param->u.crypt.alg != NULL) {
|
||||
memcpy(sec.keys[param->u.crypt.idx],
|
||||
param->u.crypt.key,
|
||||
param->u.crypt.key_len);
|
||||
sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len;
|
||||
sec.flags |= (1 << param->u.crypt.idx);
|
||||
memcpy(sec.keys[param->u.crypt.idx],
|
||||
param->u.crypt.key,
|
||||
param->u.crypt.key_len);
|
||||
sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len;
|
||||
sec.flags |= (1 << param->u.crypt.idx);
|
||||
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
|
||||
sec.flags |= SEC_LEVEL;
|
||||
sec.level = SEC_LEVEL_1;
|
||||
} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
|
||||
sec.flags |= SEC_LEVEL;
|
||||
sec.level = SEC_LEVEL_2;
|
||||
} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
|
||||
sec.flags |= SEC_LEVEL;
|
||||
sec.level = SEC_LEVEL_3;
|
||||
}
|
||||
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
|
||||
sec.flags |= SEC_LEVEL;
|
||||
sec.level = SEC_LEVEL_1;
|
||||
} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
|
||||
sec.flags |= SEC_LEVEL;
|
||||
sec.level = SEC_LEVEL_2;
|
||||
} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
|
||||
sec.flags |= SEC_LEVEL;
|
||||
sec.level = SEC_LEVEL_3;
|
||||
}
|
||||
done:
|
||||
if (ieee->set_security)
|
||||
|
Loading…
Reference in New Issue
Block a user