Linux wireless drivers development
 help / color / mirror / Atom feed
From: Peter Stuge <peter@stuge.se>
To: Pavel Roskin <proski@gnu.org>
Cc: linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org,
	John W Linville <linville@tuxdriver.com>
Subject: Re: [ath9k-devel] [PATCH] ath9k: stop on rates with idx -1 in ath9k rate control's .tx_status
Date: Sat, 11 Feb 2012 16:06:14 +0100	[thread overview]
Message-ID: <20120211150614.30728.qmail@stuge.se> (raw)
In-Reply-To: <20120211150152.4823.8570.stgit@ae>

Pavel Roskin wrote:
> Rate control algorithms are supposed to stop processing when they
> encounter a rate with the index -1.  Checking for rate->count not being
> zero is not enough.

Maybe it's a good idea to use an unsigned variable and check for the
actual error condition when it can happen, instead of checking for an
"overflow" after the fact?


> +++ b/drivers/net/wireless/ath/ath9k/rc.c
> @@ -1346,7 +1346,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
>  	fc = hdr->frame_control;
>  	for (i = 0; i < sc->hw->max_rates; i++) {
>  		struct ieee80211_tx_rate *rate = &tx_info->status.rates[i];
> -		if (!rate->count)
> +		if (rate->idx < 0 || !rate->count)
>  			break;

At the very least this could test for <= 0.


//Peter

  reply	other threads:[~2012-02-11 15:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-11 15:01 [PATCH] ath9k: stop on rates with idx -1 in ath9k rate control's .tx_status Pavel Roskin
2012-02-11 15:06 ` Peter Stuge [this message]
2012-02-11 15:19   ` [ath9k-devel] " Pavel Roskin
2012-02-11 19:38 ` Adrian Chadd

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=20120211150614.30728.qmail@stuge.se \
    --to=peter@stuge.se \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=proski@gnu.org \
    /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