Subject: [PATCH] bcm43xx-d80211 (try 2): Fix an off-by-one condition in handle_irq_noise

From: Larry Finger <[email-masked]>
Date: Mon, 10 Jul 2006 18:16:01 -0500

An assert statement near the start of handle_irq_noise in the d80211 version of bcm43xx_main.c is
there to protect against out of bound addressing using variable bcm->noisecalc.nr_samples. The
arrays in question have a dimension of 8, thus the value must be < 8. This patch mirrors the one
submitted earlier for the softmac version of bcm43xx.

Signed-Off-By: Larry.Finger <[email-masked]>

========================================================

index a400bd6..1db471e 100644
--- a/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
@@ -1434,7 +1434,7 @@ static void handle_irq_noise(struct bcm4
  		goto generate_new;

  	/* Get the noise samples. */
-	assert(bcm->noisecalc.nr_samples <= 8);
+	assert(bcm->noisecalc.nr_samples < 8);
  	i = bcm->noisecalc.nr_samples;
  	noise[0] = limit_value(noise[0], 0, ARRAY_SIZE(radio->nrssi_lt) - 1);
  	noise[1] = limit_value(noise[1], 0, ARRAY_SIZE(radio->nrssi_lt) - 1);

========================