Commit cf867c39 authored by Larry Finger's avatar Larry Finger Committed by Greg Kroah-Hartman

staging: r8188eu: Fix more Smatch warnings and errors

After updating Smatch, the following new errors and warnings are reported:

drivers/staging/rtl8188eu/core/rtw_recv.c:368 recvframe_chkmic() warn: variable dereferenced before check 'psecuritypriv' (see line 364)
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:2642 rtw_wps_start() warn: variable dereferenced before check 'pdata' (see line 2636)
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:4461 rtw_dbg_port() error: we previously assumed 'pregpriv' could be null (see line 4453)
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c:4473 rtw_dbg_port() error: we previously assumed 'pregpriv' could be null (see line 4469)
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c3eaaf8b
...@@ -361,16 +361,15 @@ static int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvfra ...@@ -361,16 +361,15 @@ static int recvframe_chkmic(struct adapter *adapter, union recv_frame *precvfra
/* calculate mic code */ /* calculate mic code */
if (stainfo != NULL) { if (stainfo != NULL) {
if (IS_MCAST(prxattrib->ra)) { if (IS_MCAST(prxattrib->ra)) {
mickey = &psecuritypriv->dot118021XGrprxmickey[prxattrib->key_index].skey[0];
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n recvframe_chkmic: bcmc key\n"));
if (!psecuritypriv) { if (!psecuritypriv) {
res = _FAIL; res = _FAIL;
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("\n recvframe_chkmic:didn't install group key!!!!!!!!!!\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("\n recvframe_chkmic:didn't install group key!!!!!!!!!!\n"));
DBG_88E("\n recvframe_chkmic:didn't install group key!!!!!!!!!!\n"); DBG_88E("\n recvframe_chkmic:didn't install group key!!!!!!!!!!\n");
goto exit; goto exit;
} }
mickey = &psecuritypriv->dot118021XGrprxmickey[prxattrib->key_index].skey[0];
RT_TRACE(_module_rtl871x_recv_c_, _drv_info_, ("\n recvframe_chkmic: bcmc key\n"));
} else { } else {
mickey = &stainfo->dot11tkiprxmickey.skey[0]; mickey = &stainfo->dot11tkiprxmickey.skey[0];
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("\n recvframe_chkmic: unicast key\n")); RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("\n recvframe_chkmic: unicast key\n"));
......
...@@ -2633,13 +2633,13 @@ static int rtw_wps_start(struct net_device *dev, ...@@ -2633,13 +2633,13 @@ static int rtw_wps_start(struct net_device *dev,
struct iw_point *pdata = &wrqu->data; struct iw_point *pdata = &wrqu->data;
u32 u32wps_start = 0; u32 u32wps_start = 0;
ret = copy_from_user((void *)&u32wps_start, pdata->pointer, 4); if ((padapter->bDriverStopped) || (pdata == NULL)) {
if (ret) {
ret = -EINVAL; ret = -EINVAL;
goto exit; goto exit;
} }
if ((padapter->bDriverStopped) || (pdata == NULL)) { ret = copy_from_user((void *)&u32wps_start, pdata->pointer, 4);
if (ret) {
ret = -EINVAL; ret = -EINVAL;
goto exit; goto exit;
} }
...@@ -4450,11 +4450,9 @@ static int rtw_dbg_port(struct net_device *dev, ...@@ -4450,11 +4450,9 @@ static int rtw_dbg_port(struct net_device *dev,
struct registry_priv *pregpriv = &padapter->registrypriv; struct registry_priv *pregpriv = &padapter->registrypriv;
/* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, 0x3: enable both 2.4g and 5g */ /* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, 0x3: enable both 2.4g and 5g */
/* default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */ /* default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */
if (pregpriv && if (!pregpriv)
(extra_arg == 0 || break;
extra_arg == 1 || if (extra_arg >= 0 && extra_arg <= 3) {
extra_arg == 2 ||
extra_arg == 3)) {
pregpriv->rx_stbc = extra_arg; pregpriv->rx_stbc = extra_arg;
DBG_88E("set rx_stbc =%d\n", pregpriv->rx_stbc); DBG_88E("set rx_stbc =%d\n", pregpriv->rx_stbc);
} else { } else {
...@@ -4466,7 +4464,9 @@ static int rtw_dbg_port(struct net_device *dev, ...@@ -4466,7 +4464,9 @@ static int rtw_dbg_port(struct net_device *dev,
{ {
struct registry_priv *pregpriv = &padapter->registrypriv; struct registry_priv *pregpriv = &padapter->registrypriv;
/* 0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec) */ /* 0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec) */
if (pregpriv && extra_arg >= 0 && extra_arg < 3) { if (!pregpriv)
break;
if (extra_arg >= 0 && extra_arg < 3) {
pregpriv->ampdu_enable = extra_arg; pregpriv->ampdu_enable = extra_arg;
DBG_88E("set ampdu_enable =%d\n", pregpriv->ampdu_enable); DBG_88E("set ampdu_enable =%d\n", pregpriv->ampdu_enable);
} else { } else {
......
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