public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: rtl8712: avoid a useless call to memset().
       [not found] <0121210085516.GO6568@mwanda>
@ 2012-12-11  0:20 ` Cyril Roelandt
  2012-12-11  6:32   ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Cyril Roelandt @ 2012-12-11  0:20 UTC (permalink / raw)
  To: dan.carpenter
  Cc: Larry.Finger, florian.c.schilhabel, gregkh, yongjun_wei,
	marcos.souza.org, devel, linux-kernel, kernel-janitors,
	Cyril Roelandt

In r8711_wx_get_wap(), make sure we do not call memcpy() on a memory area that
has just been zeroed by a call to memset().

Signed-off-by: Cyril Roelandt <tipecaml@gmail.com>
---
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 3a64790..72c51b3 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1131,11 +1131,11 @@ static int r8711_wx_get_wap(struct net_device *dev,
 	struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
 
 	wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-	memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
-	if (check_fwstate(pmlmepriv, _FW_LINKED |
-	    WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) {
+	if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE |
+				     WIFI_AP_STATE))
 		memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN);
-	}
+	else
+		memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
 	return 0;
 }
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] staging: rtl8712: avoid a useless call to memset().
  2012-12-11  0:20 ` [PATCH v2] staging: rtl8712: avoid a useless call to memset() Cyril Roelandt
@ 2012-12-11  6:32   ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2012-12-11  6:32 UTC (permalink / raw)
  To: Cyril Roelandt
  Cc: Larry.Finger, florian.c.schilhabel, gregkh, yongjun_wei,
	marcos.souza.org, devel, linux-kernel, kernel-janitors

On Tue, Dec 11, 2012 at 01:20:48AM +0100, Cyril Roelandt wrote:
> In r8711_wx_get_wap(), make sure we do not call memcpy() on a memory area that
> has just been zeroed by a call to memset().
> 

Acked-by: Dan Carpenter <dan.carpenter@oracle.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-11  6:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <0121210085516.GO6568@mwanda>
2012-12-11  0:20 ` [PATCH v2] staging: rtl8712: avoid a useless call to memset() Cyril Roelandt
2012-12-11  6:32   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox