summaryrefslogtreecommitdiff
path: root/drivers/staging/ks7010
diff options
context:
space:
mode:
authorTobin C. Harding <me@tobin.cc>2017-04-10 13:15:49 +1000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-11 16:05:50 +0200
commit9ff19a6e35ab460c07dc40c563b57b0ad866e2e9 (patch)
treeb91780a6084ea0c2e6a2a653035a7a5d160db568 /drivers/staging/ks7010
parentdc59ef2af26de72289b5ac576298445c676f2c5b (diff)
staging: ks7010: move null check before dereference
Function parameter is cast to a local pointer which is then dereferenced before it is checked to be non-NULL. Move pointer null check to be before the pointer is dereferenced. Signed-off-by: Tobin C. Harding <me@tobin.cc> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010')
-rw-r--r--drivers/staging/ks7010/ks_wlan_net.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 89fcd23e8f94..eb3573e5365d 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -1771,6 +1771,8 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
unsigned int commit = 0;
enc = (struct iw_encode_ext *)extra;
+ if (!enc)
+ return -EINVAL;
DPRINTK(2, "flags=%04X:: ext_flags=%08X\n", dwrq->flags,
enc->ext_flags);
@@ -1786,9 +1788,6 @@ static int ks_wlan_set_encode_ext(struct net_device *dev,
if (dwrq->flags & IW_ENCODE_DISABLED)
priv->wpa.key[index].key_len = 0;
- if (!enc)
- return -EINVAL;
-
priv->wpa.key[index].ext_flags = enc->ext_flags;
if (enc->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
priv->wpa.txkey = index;