[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20170209110643.22590-1-colin.king@canonical.com>
Date: Thu, 9 Feb 2017 11:06:43 +0000
From: Colin King <colin.king@...onical.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
simran singhal <singhalsimran0@...il.com>,
Bhumika Goyal <bhumirks@...il.com>,
Binoy Jayan <binoy.jayan@...aro.org>,
"David S . Miller" <davem@...emloft.net>,
Florian Westphal <fw@...len.de>,
Amitoj Kaur Chawla <amitoj1606@...il.com>,
Janani Ravichandran <janani.rvchndrn@...il.com>,
Baoyou Xie <baoyou.xie@...aro.org>,
Bhaktipriya Shridhar <bhaktipriya96@...il.com>,
devel@...verdev.osuosl.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: rtl8192u: remove redundant null check on array alg
From: Colin Ian King <colin.king@...onical.com>
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@...onical.com>
---
.../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 32 ++++++++++------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 844e257..02b9f7a 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -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);
-
- 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;
- }
+ 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;
}
done:
if (ieee->set_security)
--
2.10.2
Powered by blists - more mailing lists