linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] rndis_wlan: use ARRAY_SIZE instead of sizeof when adding 11g rates
@ 2008-05-27  8:15 Jussi Kivilinna
  2008-05-27  8:15 ` [PATCH 2/2] rndis_wlan: add missing range check for power_output modparam Jussi Kivilinna
  0 siblings, 1 reply; 2+ messages in thread
From: Jussi Kivilinna @ 2008-05-27  8:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, Scott Ashcroft, Jussi Kivilinna

From: Scott Ashcroft <scott.ashcroft@talk21.com>

While figuring out the TKIP problem I found a bug in the code which adds the 11g 
rates. It's using sizeof instead of ARRAY_SIZE to terminate the for loop. This makes 
it fall off the end of the rates array start into the frequency array instead. Running 
"iwlist rate" should show the problem as there will always be 32 rates with the last 
few being bogus.

The following patch will fix it.

Signed-off-by: Scott Ashcroft <scott.ashcroft@talk21.com>
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
---

 drivers/net/wireless/rndis_wlan.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index d0b1fb1..ed310f8 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1108,7 +1108,7 @@ static int rndis_iw_get_range(struct net_device *dev,
 	/* fill in 802.11g rates */
 	if (has_80211g_rates) {
 		num = range->num_bitrates;
-		for (i = 0; i < sizeof(rates_80211g); i++) {
+		for (i = 0; i < ARRAY_SIZE(rates_80211g); i++) {
 			for (j = 0; j < num; j++) {
 				if (range->bitrate[j] ==
 					rates_80211g[i] * 1000000)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] rndis_wlan: add missing range check for power_output modparam
  2008-05-27  8:15 [PATCH 1/2] rndis_wlan: use ARRAY_SIZE instead of sizeof when adding 11g rates Jussi Kivilinna
@ 2008-05-27  8:15 ` Jussi Kivilinna
  0 siblings, 0 replies; 2+ messages in thread
From: Jussi Kivilinna @ 2008-05-27  8:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, Jussi Kivilinna

Range check for power_output were missing.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
---

 drivers/net/wireless/rndis_wlan.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index ed310f8..f7cca7d 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2414,6 +2414,11 @@ static int bcm4320_early_init(struct usbnet *dev)
 	else if (priv->param_power_save > 2)
 		priv->param_power_save = 2;
 
+	if (priv->param_power_output < 0)
+		priv->param_power_output = 0;
+	else if (priv->param_power_output > 3)
+		priv->param_power_output = 3;
+
 	if (priv->param_roamtrigger < -80)
 		priv->param_roamtrigger = -80;
 	else if (priv->param_roamtrigger > -60)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-27  8:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-27  8:15 [PATCH 1/2] rndis_wlan: use ARRAY_SIZE instead of sizeof when adding 11g rates Jussi Kivilinna
2008-05-27  8:15 ` [PATCH 2/2] rndis_wlan: add missing range check for power_output modparam Jussi Kivilinna

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).