[PATCH V3 1/8] staging: rtl8712: fix buggy size calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

From: Joshua Clayton <stillcompiling@xxxxxxxxx>
To: Larry Finger <Larry.Finger@xxxxxxxxxxxx>,
	Florian Schilhabel <florian.c.schilhabel@xxxxxxxxxxxxxx>,
	Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>,
	Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx>,
	Nitin Kuppelur <nitinkuppelur@xxxxxxxxx>,
	Joshua Clayton <stillcompiling@xxxxxxxxx>,
	Vaishali Thakkar <vthakkar1994@xxxxxxxxx>,
	Tapasweni Pathak <tapaswenipathak@xxxxxxxxx>,
	Daniel Baluta <daniel.baluta@xxxxxxxxx>,
	Melike Yurtoglu <aysemelikeyurtoglu@xxxxxxxxx>,
	Max Perepelitsyn <mperepelitsyn@xxxxxxxxx>,
	Aya Mahfouz <mahfouz.saif.elyazal@xxxxxxxxx>,
	Cristina Opriceana <cristina.opriceana@xxxxxxxxx>,
	Dogukan Ergun <dogukan.ergun@xxxxxxxxx>,
	Julia Lawall <Julia.Lawall@xxxxxxx>,
	Dan Carpenter <dan.carpenter@xxxxxxxxxx>,
	Haneen Mohammed <hamohammed.sa@xxxxxxxxx>,
	Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
Cc: devel@xxxxxxxxxxxxxxxxxxxx,
	linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH V3 1/8] staging: rtl8712: fix buggy size calculation
Date: Mon, 27 Jul 2015 21:41:10 -0700
Message-Id: <305999598d7738feabdc8e5df5400b3e7be7f5ed.1438057939.git.stillcompiling@xxxxxxxxx>
X-Mailer: git-send-email 2.4.6
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
In-Reply-To: <cover.1438057939.git.stillcompiling@xxxxxxxxx>
References: <cover.1438057939.git.stillcompiling@xxxxxxxxx>

r8712_get_ndis_wlan_bssid_ex_sz has a "6 * sizeof(unsigned long)"
where the underlying struct has a 6 * unsigned char.
Simplify the calculation by just subtracting the variable part from
the size of the struct.

This also gets rid of a use of typedef NDIS_802_11_RATES_EX

Signed-off-by: Joshua Clayton <stillcompiling@xxxxxxxxx>
---
 drivers/staging/rtl8712/rtl871x_mlme.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c
index c044b0e..6b3451f 100644
--- a/drivers/staging/rtl8712/rtl871x_mlme.c
+++ b/drivers/staging/rtl8712/rtl871x_mlme.c
@@ -210,17 +210,7 @@ void r8712_generate_random_ibss(u8 *pibss)
 
 uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss)
 {
-	uint t_len;
-
-	t_len = sizeof(u32) + 6 * sizeof(unsigned long) + 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) + bss->IELength;
-	return t_len;
+	return sizeof(*bss) + bss->IELength - MAX_IE_SZ;
 }
 
 u8 *r8712_get_capability_from_ie(u8 *ie)
-- 
2.4.6

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux