lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@gmail.com>
Date:	Mon, 27 Jul 2015 07:31:50 -0700
From:	Joshua Clayton <stillcompiling@...il.com>
To:	Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc:	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

From: Joshua Clayton <stillcompiling@...il.com>
To: Larry Finger <Larry.Finger@...inger.net>,
	Florian Schilhabel <florian.c.schilhabel@...glemail.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudip Mukherjee <sudipm.mukherjee@...il.com>,
	Nitin Kuppelur <nitinkuppelur@...il.com>,
	Joshua Clayton <stillcompiling@...il.com>,
	Vaishali Thakkar <vthakkar1994@...il.com>,
	Tapasweni Pathak <tapaswenipathak@...il.com>,
	Daniel Baluta <daniel.baluta@...el.com>,
	Melike Yurtoglu <aysemelikeyurtoglu@...il.com>,
	Max Perepelitsyn <mperepelitsyn@...il.com>,
	Aya Mahfouz <mahfouz.saif.elyazal@...il.com>,
	Cristina Opriceana <cristina.opriceana@...il.com>,
	Dogukan Ergun <dogukan.ergun@...il.com>,
	Julia Lawall <Julia.Lawall@...6.fr>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Haneen Mohammed <hamohammed.sa@...il.com>,
	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc: devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH V2 2/6] staging: rtl8712: simplify size calculation
Date: Mon, 27 Jul 2015 07:31:50 -0700
Message-Id: <1438007514-9228-3-git-send-email-stillcompiling@...il.com>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>
References: <1438007514-9228-1-git-send-email-stillcompiling@...il.com>

replace item-by-item  size calculation of a struct
with the size of the struct.

This gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@...il.com>

diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c
index e35854d..f07050d 100644
--- a/drivers/staging/rtl8712/rtl871x_cmd.c
+++ b/drivers/staging/rtl8712/rtl871x_cmd.c
@@ -471,7 +471,6 @@ u8 r8712_createbss_cmd(struct _adapter *padapter)
 
 u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 {
-	uint t_len = 0;
 	struct ndis_wlan_bssid_ex *psecnetwork;
 	struct cmd_obj		*pcmd;
 	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
@@ -486,14 +485,6 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 	pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
 	if (pcmd == NULL)
 		return _FAIL;
-	t_len = sizeof(u32) + 6 * sizeof(unsigned char) + 2 +
-			sizeof(struct ndis_802_11_ssid) + sizeof(u32) +
-			sizeof(s32) +
-			sizeof(enum NDIS_802_11_NETWORK_TYPE) +
-			sizeof(struct NDIS_802_11_CONFIGURATION) +
-			sizeof(enum NDIS_802_11_NETWORK_INFRASTRUCTURE) +
-			sizeof(NDIS_802_11_RATES_EX) +
-			sizeof(u32) + MAX_IE_SZ;
 
 	/* for hidden ap to set fw_state here */
 	if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) !=
@@ -516,7 +507,7 @@ u8 r8712_joinbss_cmd(struct _adapter  *padapter, struct wlan_network *pnetwork)
 		kfree(pcmd);
 		return _FAIL;
 	}
-	memcpy(psecnetwork, &pnetwork->network, t_len);
+	memcpy(psecnetwork, &pnetwork->network, sizeof(*psecnetwork));
 	psecuritypriv->authenticator_ie[0] = (unsigned char)
 					     psecnetwork->IELength;
 	if ((psecnetwork->IELength-12) < (256 - 1))
-- 
2.4.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ