Commit 153c5d81 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

staging: wlan-ng: fix exit return when sme->key_idx >= NUM_WEPKEYS

Currently the exit return path when sme->key_idx >= NUM_WEPKEYS is via
label 'exit' and this checks if result is non-zero, however result has
not been initialized and contains garbage.  Fix this by replacing the
goto with a return with the error code.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 0ca6d8e7 ("Staging: wlan-ng: replace switch-case statements with macro")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191014110201.9874-1-colin.king@canonical.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4f5cafb5
...@@ -469,10 +469,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev, ...@@ -469,10 +469,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
/* Set the encryption - we only support wep */ /* Set the encryption - we only support wep */
if (is_wep) { if (is_wep) {
if (sme->key) { if (sme->key) {
if (sme->key_idx >= NUM_WEPKEYS) { if (sme->key_idx >= NUM_WEPKEYS)
err = -EINVAL; return -EINVAL;
goto exit;
}
result = prism2_domibset_uint32(wlandev, result = prism2_domibset_uint32(wlandev,
DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID, DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment