Skip to content

Commit 0fb3ff2

Browse files
Colin Ian Kingsmb49
authored andcommitted
staging: wlan-ng: fix exit return when sme->key_idx >= NUM_WEPKEYS
BugLink: https://bugs.launchpad.net/bugs/1850456 commit 153c5d8 upstream. 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: 0ca6d8e ("Staging: wlan-ng: replace switch-case statements with macro") Signed-off-by: Colin Ian King <[email protected]> Cc: stable <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Connor Kuehl <[email protected]> Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
1 parent 70c7c76 commit 0fb3ff2

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/staging/wlan-ng/cfg80211.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
469469
/* Set the encryption - we only support wep */
470470
if (is_wep) {
471471
if (sme->key) {
472-
if (sme->key_idx >= NUM_WEPKEYS) {
473-
err = -EINVAL;
474-
goto exit;
475-
}
472+
if (sme->key_idx >= NUM_WEPKEYS)
473+
return -EINVAL;
476474

477475
result = prism2_domibset_uint32(wlandev,
478476
DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,

0 commit comments

Comments
 (0)