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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 <[email protected]> To: Larry Finger <[email protected]>, Florian Schilhabel <[email protected]>, Greg Kroah-Hartman <[email protected]>, Sudip Mukherjee <[email protected]>, Nitin Kuppelur <[email protected]>, Joshua Clayton <[email protected]>, Vaishali Thakkar <[email protected]>, Tapasweni Pathak <[email protected]>, Daniel Baluta <[email protected]>, Melike Yurtoglu <[email protected]>, Max Perepelitsyn <[email protected]>, Aya Mahfouz <[email protected]>, Cristina Opriceana <[email protected]>, Dogukan Ergun <[email protected]>, Julia Lawall <[email protected]>, Dan Carpenter <[email protected]>, Haneen Mohammed <[email protected]>, Rickard Strandqvist <[email protected]> Cc: [email protected], [email protected] Subject: [PATCH V2 1/6] staging: rtl8712: fix buggy size calculation Date: Mon, 27 Jul 2015 07:31:49 -0700 Message-Id: <[email protected]> X-Mailer: git-send-email 2.4.6 In-Reply-To: <[email protected]> References: <[email protected]> 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 <[email protected]> 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 [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
