From: Dan Carpenter <dan.carpenter@oracle.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch 2/2] staging: ks7010: remove bogus NULL checks
Date: Tue, 14 Jun 2016 11:17:02 +0000 [thread overview]
Message-ID: <20160614111702.GB25457@mwanda> (raw)
enc->rx_seq[] and enc->key[] are arrays, not pointers and they can't be
NULL. Let's remove these NULL checks.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 8ef0f11..fc93028 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -1910,11 +1910,8 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
priv->wpa.txkey = index;
commit |= SME_WEP_INDEX;
} else if (enc->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
- if (enc->rx_seq)
- memcpy(&priv->wpa.key[index].rx_seq[0],
- enc->rx_seq, IW_ENCODE_SEQ_MAX_SIZE);
- else
- return -EINVAL;
+ memcpy(&priv->wpa.key[index].rx_seq[0],
+ enc->rx_seq, IW_ENCODE_SEQ_MAX_SIZE);
}
memcpy(&priv->wpa.key[index].addr.sa_data[0],
@@ -1935,7 +1932,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
priv->reg.privacy_invoked = 0x01;
commit |= SME_WEP_FLAG;
}
- if (enc->key && enc->key_len) {
+ if (enc->key_len) {
memcpy(&priv->wpa.key[index].key_val[0],
&enc->key[0], enc->key_len);
priv->wpa.key[index].key_len = enc->key_len;
@@ -1947,7 +1944,7 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
priv->reg.privacy_invoked = 0x01;
commit |= SME_WEP_FLAG;
}
- if (enc->key && enc->key_len = 32) {
+ if (enc->key_len = 32) {
memcpy(&priv->wpa.key[index].key_val[0],
&enc->key[0], enc->key_len - 16);
priv->wpa.key[index].key_len
reply other threads:[~2016-06-14 11:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20160614111702.GB25457@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.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