lkml.org 
[lkml]   [2012]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: rtl8712: avoid a useless call to memset().
Hi Cyril,
you patch is correct ..but being an advocate of defensive programming
i would say the original version especially since the number of bytes is small.

re,
wh

Am 05.12.2012 02:22, schrieb 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 | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> index 3a64790..2c73319 100644
> --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> @@ -1131,10 +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)) {
> memcpy(wrqu->ap_addr.sa_data, pcur_bss->MacAddress, ETH_ALEN);
> + } else {
> + memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
> }
> return 0;
> }


\
 
 \ /
  Last update: 2012-12-05 10:01    [W:0.074 / U:1.420 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site