staging: rtl8188eu: core: Remove redundant memset before memcpy
authorTapasweni Pathak <tapaswenipathak@gmail.com>
Sun, 26 Oct 2014 16:05:04 +0000 (21:35 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Oct 2014 07:41:42 +0000 (15:41 +0800)
The region set by the call to memset, immediately overwritten by the
subsequent call to memcpy makes the memset redundant.

This patch removes the redundant memset before memcpy using the
following coccinelle script:

@@
expression e1,e2,e3,e4;
@@

- memset(e1,e2,e3);
  memcpy(e1,e4,e3);

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
drivers/staging/rtl8188eu/core/rtw_mlme.c

index fc280ce57d2c215dfdc1723e42242bd1ae5bd27d..2faf6b2e812915ace02727b5b8cd702fff52611d 100644 (file)
@@ -98,7 +98,6 @@ u8 rtw_do_join(struct adapter *padapter)
 
                                pibss = padapter->registrypriv.dev_network.MacAddress;
 
-                               memset(&pdev_network->Ssid, 0, sizeof(struct ndis_802_11_ssid));
                                memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(struct ndis_802_11_ssid));
 
                                rtw_update_registrypriv_dev_network(padapter);
index bbebe67a77db83d36233d58160151877970661c5..b4e8504b34ed976e322540b31520cd394b722bca 100644 (file)
@@ -674,7 +674,6 @@ void rtw_surveydone_event_callback(struct adapter   *adapter, u8 *pbuf)
 
                                        RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("switching to adhoc master\n"));
 
-                                       memset(&pdev_network->Ssid, 0, sizeof(struct ndis_802_11_ssid));
                                        memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(struct ndis_802_11_ssid));
 
                                        rtw_update_registrypriv_dev_network(adapter);
@@ -1334,7 +1333,6 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf)
 
                        memcpy(pdev_network, &tgt_network->network, get_wlan_bssid_ex_sz(&tgt_network->network));
 
-                       memset(&pdev_network->Ssid, 0, sizeof(struct ndis_802_11_ssid));
                        memcpy(&pdev_network->Ssid, &pmlmepriv->assoc_ssid, sizeof(struct ndis_802_11_ssid));
 
                        rtw_update_registrypriv_dev_network(adapter);