From: Colin King <colin.king@canonical.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
simran singhal <singhalsimran0@gmail.com>,
Bhumika Goyal <bhumirks@gmail.com>,
Binoy Jayan <binoy.jayan@linaro.org>,
"David S . Miller" <davem@davemloft.net>,
Florian Westphal <fw@strlen.de>,
Amitoj Kaur Chawla <amitoj1606@gmail.com>,
Janani Ravichandran <janani.rvchndrn@gmail.com>,
Baoyou Xie <baoyou.xie@linaro.org>,
Bhaktipriya Shridhar <bhaktipriya96@gmail.com>,
devel@driverdev.osuosl.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] staging: rtl8192u: remove redundant null check on array alg
Date: Thu, 09 Feb 2017 11:06:43 +0000 [thread overview]
Message-ID: <20170209110643.22590-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.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@canonical.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
next reply other threads:[~2017-02-09 11:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 11:06 Colin King [this message]
2018-01-22 15:57 ` [PATCH] staging: rtl8192u: remove redundant initialization of 'timeout' Colin King
2019-04-04 9:32 ` [PATCH] staging: rtl8192u: remove redundant null check on array 'data' Colin King
2019-04-04 9:41 ` Dan Carpenter
2019-04-04 10:28 ` Mukesh Ojha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170209110643.22590-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=amitoj1606@gmail.com \
--cc=baoyou.xie@linaro.org \
--cc=bhaktipriya96@gmail.com \
--cc=bhumirks@gmail.com \
--cc=binoy.jayan@linaro.org \
--cc=davem@davemloft.net \
--cc=devel@driverdev.osuosl.org \
--cc=fw@strlen.de \
--cc=gregkh@linuxfoundation.org \
--cc=janani.rvchndrn@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=singhalsimran0@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox