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: <1307066770-27309-5-git-send-email-Gregory.Dietsche@cuw.edu>
Date:	Thu,  2 Jun 2011 21:06:10 -0500
From:	Greg Dietsche <Gregory.Dietsche@....edu>
To:	sgruszka@...hat.com, linville@...driver.com
Cc:	kernel-janitors@...r.kernel.org, linux-wireless@...r.kernel.org,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	Greg Dietsche <Gregory.Dietsche@....edu>
Subject: [PATCH 5/5] iwlegacy: add missing null check

lq_sta has other null checks in this funcion.
assuming they are correct, this additional null check
should be added too.

Signed-off-by: Greg Dietsche <Gregory.Dietsche@....edu>
---
 drivers/net/wireless/iwlegacy/iwl-4965-rs.c |   66 ++++++++++++++-------------
 1 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
index 24d1499..a475aac 100644
--- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
@@ -2275,40 +2275,42 @@ iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
 	if (rate_control_send_low(sta, priv_sta, txrc))
 		return;
 
-	rate_idx  = lq_sta->last_txrate_idx;
-
-	if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
-		rate_idx -= IWL_FIRST_OFDM_RATE;
-		/* 6M and 9M shared same MCS index */
-		rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0;
-		if (iwl4965_rs_extract_rate(lq_sta->last_rate_n_flags) >=
-			 IWL_RATE_MIMO2_6M_PLCP)
-			rate_idx = rate_idx + MCS_INDEX_PER_STREAM;
-		info->control.rates[0].flags = IEEE80211_TX_RC_MCS;
-		if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK)
-			info->control.rates[0].flags |=
-					IEEE80211_TX_RC_SHORT_GI;
-		if (lq_sta->last_rate_n_flags & RATE_MCS_DUP_MSK)
-			info->control.rates[0].flags |=
-					IEEE80211_TX_RC_DUP_DATA;
-		if (lq_sta->last_rate_n_flags & RATE_MCS_HT40_MSK)
-			info->control.rates[0].flags |=
-					IEEE80211_TX_RC_40_MHZ_WIDTH;
-		if (lq_sta->last_rate_n_flags & RATE_MCS_GF_MSK)
-			info->control.rates[0].flags |=
-					IEEE80211_TX_RC_GREEN_FIELD;
-	} else {
-		/* Check for invalid rates */
-		if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) ||
-				((sband->band == IEEE80211_BAND_5GHZ) &&
-				 (rate_idx < IWL_FIRST_OFDM_RATE)))
-			rate_idx = rate_lowest_index(sband, sta);
-		/* On valid 5 GHz rate, adjust index */
-		else if (sband->band == IEEE80211_BAND_5GHZ)
+	if (lq_sta) {
+		rate_idx  = lq_sta->last_txrate_idx;
+
+		if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
 			rate_idx -= IWL_FIRST_OFDM_RATE;
-		info->control.rates[0].flags = 0;
+			/* 6M and 9M shared same MCS index */
+			rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0;
+			if (iwl4965_rs_extract_rate(lq_sta->last_rate_n_flags) >=
+				 IWL_RATE_MIMO2_6M_PLCP)
+				rate_idx = rate_idx + MCS_INDEX_PER_STREAM;
+			info->control.rates[0].flags = IEEE80211_TX_RC_MCS;
+			if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK)
+				info->control.rates[0].flags |=
+						IEEE80211_TX_RC_SHORT_GI;
+			if (lq_sta->last_rate_n_flags & RATE_MCS_DUP_MSK)
+				info->control.rates[0].flags |=
+						IEEE80211_TX_RC_DUP_DATA;
+			if (lq_sta->last_rate_n_flags & RATE_MCS_HT40_MSK)
+				info->control.rates[0].flags |=
+						IEEE80211_TX_RC_40_MHZ_WIDTH;
+			if (lq_sta->last_rate_n_flags & RATE_MCS_GF_MSK)
+				info->control.rates[0].flags |=
+						IEEE80211_TX_RC_GREEN_FIELD;
+		} else {
+			/* Check for invalid rates */
+			if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) ||
+					((sband->band == IEEE80211_BAND_5GHZ) &&
+					 (rate_idx < IWL_FIRST_OFDM_RATE)))
+				rate_idx = rate_lowest_index(sband, sta);
+			/* On valid 5 GHz rate, adjust index */
+			else if (sband->band == IEEE80211_BAND_5GHZ)
+				rate_idx -= IWL_FIRST_OFDM_RATE;
+			info->control.rates[0].flags = 0;
+		}
+		info->control.rates[0].idx = rate_idx;
 	}
-	info->control.rates[0].idx = rate_idx;
 
 }
 
-- 
1.7.2.5

--
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