lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1432223628-1664-24-git-send-email-mateusz.kulikowski@gmail.com>
Date:	Thu, 21 May 2015 17:53:36 +0200
From:	Mateusz Kulikowski <mateusz.kulikowski@...il.com>
To:	gregkh@...uxfoundation.org
Cc:	Mateusz Kulikowski <mateusz.kulikowski@...il.com>,
	dan.carpenter@...cle.com, joe@...ches.com,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH v4 23/35] staging: rtl8192e: Fix LONG_LING in rtllib_parse_info_param()

Take out MIFE_TYPE_HT_CAP processing into separate function -
rtllib_parse_mfie_ht_cap()

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@...il.com>
---
 drivers/staging/rtl8192e/rtllib_rx.c | 49 +++++++++++++++++++++---------------
 1 file changed, 29 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index c888f2d..e09aa81 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -2014,6 +2014,33 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee,
 	}
 }
 
+static void rtllib_parse_mfie_ht_cap(struct rtllib_info_element *info_element,
+				     struct rtllib_network *network,
+				     u16 *tmp_htcap_len)
+{
+	struct bss_ht *ht = &network->bssht;
+
+	*tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN);
+	if (*tmp_htcap_len != 0) {
+		ht->bdHTSpecVer = HT_SPEC_VER_EWC;
+		ht->bdHTCapLen = min_t(u16, *tmp_htcap_len,
+				       sizeof(ht->bdHTCapBuf));
+		memcpy(ht->bdHTCapBuf, info_element->data, ht->bdHTCapLen);
+
+		ht->bdSupportHT = true;
+		ht->bdHT1R = ((((struct ht_capab_ele *)
+				ht->bdHTCapBuf))->MCS[1]) == 0;
+
+		ht->bdBandWidth = (enum ht_channel_width)
+					     (((struct ht_capab_ele *)
+					     (ht->bdHTCapBuf))->ChlWidth);
+	} else {
+		ht->bdSupportHT = false;
+		ht->bdHT1R = false;
+		ht->bdBandWidth = HT_CHANNEL_WIDTH_20;
+	}
+}
+
 int rtllib_parse_info_param(struct rtllib_device *ieee,
 		struct rtllib_info_element *info_element,
 		u16 length,
@@ -2195,27 +2222,9 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
 		case MFIE_TYPE_HT_CAP:
 			netdev_dbg(ieee->dev, "MFIE_TYPE_HT_CAP: %d bytes\n",
 				   info_element->len);
-			tmp_htcap_len = min_t(u8, info_element->len, MAX_IE_LEN);
-			if (tmp_htcap_len != 0) {
-				network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
-				network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf) ?
-					sizeof(network->bssht.bdHTCapBuf) : tmp_htcap_len;
-				memcpy(network->bssht.bdHTCapBuf,
-				       info_element->data,
-				       network->bssht.bdHTCapLen);
 
-				network->bssht.bdSupportHT = true;
-				network->bssht.bdHT1R = ((((struct ht_capab_ele *)
-							network->bssht.bdHTCapBuf))->MCS[1]) == 0;
-
-				network->bssht.bdBandWidth = (enum ht_channel_width)
-							     (((struct ht_capab_ele *)
-							     (network->bssht.bdHTCapBuf))->ChlWidth);
-			} else {
-				network->bssht.bdSupportHT = false;
-				network->bssht.bdHT1R = false;
-				network->bssht.bdBandWidth = HT_CHANNEL_WIDTH_20;
-			}
+			rtllib_parse_mfie_ht_cap(info_element, network,
+						 &tmp_htcap_len);
 			break;
 
 
-- 
1.8.4.1

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ