Skip to content

Commit

Permalink
libertas: fix signedness bug in lbs_auth_to_authtype()
Browse files Browse the repository at this point in the history
Return type for lbs_auth_to_authtype() is changed from "u8" to
"int" to return negative error code correctly.
Also an error check is added in connect handler for invalid auth
type.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Amitkumar Karwar authored and John W. Linville committed Apr 13, 2012
1 parent b4838d1 commit effcc62
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/wireless/libertas/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static const u32 cipher_suites[] = {
* Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1
* in the firmware spec
*/
static u8 lbs_auth_to_authtype(enum nl80211_auth_type auth_type)
static int lbs_auth_to_authtype(enum nl80211_auth_type auth_type)
{
int ret = -ENOTSUPP;

Expand Down Expand Up @@ -1411,7 +1411,12 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev,
goto done;
}

lbs_set_authtype(priv, sme);
ret = lbs_set_authtype(priv, sme);
if (ret == -ENOTSUPP) {
wiphy_err(wiphy, "unsupported authtype 0x%x\n", sme->auth_type);
goto done;
}

lbs_set_radio(priv, preamble, 1);

/* Do the actual association */
Expand Down

0 comments on commit effcc62

Please sign in to comment.