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>
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);
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;