Commit 3d82de0f authored by Yogesh Ashok Powar's avatar Yogesh Ashok Powar Committed by John W. Linville

mwifiex: fix smatch errors

drivers/net/wireless/mwifiex/main.c +828 mwifiex_remove_card(52)
  error: potential null derefence 'priv'.
drivers/net/wireless/mwifiex/main.c +828 mwifiex_remove_card(52)
  error: we previously assumed 'priv' could be null (see line 820)
drivers/net/wireless/mwifiex/txrx.c +90 mwifiex_process_tx(24)
  error: potential null derefence 'local_tx_pd'.
drivers/net/wireless/mwifiex/sta_ioctl.c +766
mwifiex_rate_ioctl_set_rate_value(30)
  error: buffer overflow 'rate' 14 <= 14

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarYogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f49bbd2a
...@@ -825,6 +825,10 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) ...@@ -825,6 +825,10 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
rtnl_unlock(); rtnl_unlock();
} }
priv = adapter->priv[0];
if (!priv)
goto exit_remove;
wiphy_unregister(priv->wdev->wiphy); wiphy_unregister(priv->wdev->wiphy);
wiphy_free(priv->wdev->wiphy); wiphy_free(priv->wdev->wiphy);
kfree(priv->wdev); kfree(priv->wdev);
......
...@@ -763,7 +763,7 @@ static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv, ...@@ -763,7 +763,7 @@ static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv,
if ((rate[i] & 0x7f) == (rate_cfg->rate & 0x7f)) if ((rate[i] & 0x7f) == (rate_cfg->rate & 0x7f))
break; break;
} }
if (!rate[i] || (i == MWIFIEX_SUPPORTED_RATES)) { if ((i == MWIFIEX_SUPPORTED_RATES) || !rate[i]) {
dev_err(adapter->dev, "fixed data rate %#x is out " dev_err(adapter->dev, "fixed data rate %#x is out "
"of range\n", rate_cfg->rate); "of range\n", rate_cfg->rate);
return -1; return -1;
......
...@@ -87,6 +87,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb, ...@@ -87,6 +87,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
(adapter->pps_uapsd_mode) && (adapter->pps_uapsd_mode) &&
(adapter->tx_lock_flag)) { (adapter->tx_lock_flag)) {
priv->adapter->tx_lock_flag = false; priv->adapter->tx_lock_flag = false;
if (local_tx_pd)
local_tx_pd->flags = 0; local_tx_pd->flags = 0;
} }
dev_dbg(adapter->dev, "data: -EBUSY is returned\n"); dev_dbg(adapter->dev, "data: -EBUSY is returned\n");
......
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