linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Copeland <me@bobcopeland.com>
To: linville@tuxdriver.com, jirislaby@gmail.com, mickflemm@gmail.com,
	lrodriguez@atheros.com
Cc: linux-wireless@vger.kernel.org, ath5k-devel@lists.ath5k.org,
	br1@einfach.org, Bob Copeland <me@bobcopeland.com>
Subject: [PATCH 4/4] ath5k: add bounds check to pdadc table
Date: Wed,  7 Apr 2010 23:55:59 -0400	[thread overview]
Message-ID: <1270698959-7844-5-git-send-email-me@bobcopeland.com> (raw)
In-Reply-To: <1270698959-7844-1-git-send-email-me@bobcopeland.com>

We check the bounds on pdadc once when correcting for
negative curves but not when we later copy values from
from the pdadc_tmp array, leading to a potential overrun.

Although we shouldn't hit this case in practice, let's
be consistent.

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
 drivers/net/wireless/ath/ath5k/phy.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 81bdebd..65ac50b 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -2560,7 +2560,7 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah,
 		max_idx = (pdadc_n < table_size) ? pdadc_n : table_size;
 
 		/* Fill pdadc_out table */
-		while (pdadc_0 < max_idx)
+		while (pdadc_0 < max_idx && pdadc_i < 128)
 			pdadc_out[pdadc_i++] = pdadc_tmp[pdadc_0++];
 
 		/* Need to extrapolate above this pdgain? */
-- 
1.6.3.3



  parent reply	other threads:[~2010-04-08  4:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08  3:55 [PATCH 0/4] ath5k: misc fixes Bob Copeland
2010-04-08  3:55 ` [PATCH 1/4] ath5k: correct channel setting for 2.5 mhz spacing Bob Copeland
2010-04-08  4:14   ` Bruno Randolf
2010-04-08  3:55 ` [PATCH 2/4] ath5k: clean up queue manipulation Bob Copeland
2010-04-08  4:15   ` Bruno Randolf
2010-04-08  3:55 ` [PATCH 3/4] ath5k: fix race condition in tx desc processing Bob Copeland
2010-04-08  4:15   ` Bruno Randolf
2010-04-08  3:55 ` Bob Copeland [this message]
2010-04-08  4:15   ` [PATCH 4/4] ath5k: add bounds check to pdadc table Bruno Randolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1270698959-7844-5-git-send-email-me@bobcopeland.com \
    --to=me@bobcopeland.com \
    --cc=ath5k-devel@lists.ath5k.org \
    --cc=br1@einfach.org \
    --cc=jirislaby@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=lrodriguez@atheros.com \
    --cc=mickflemm@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).