From: Luciano Coelho <luciano.coelho@nokia.com>
To: ext Felix Fietkau <nbd@openwrt.org>
Cc: "linville@tuxdriver.org" <linville@tuxdriver.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"johannes@sipsolutions.net" <johannes@sipsolutions.net>,
"Valo Kalle (Nokia-D/Tampere)" <Kalle.Valo@nokia.com>,
"Govindan Vidhya (Nokia-D/Tampere)" <vidhya.govindan@nokia.com>
Subject: Re: [PATCH] mac80211: minstrel: avoid accessing negative indices in rix_to_ndx()
Date: Fri, 03 Jul 2009 08:15:48 +0300 [thread overview]
Message-ID: <4A4D9404.9030103@nokia.com> (raw)
In-Reply-To: <4A4D4DC6.30502@openwrt.org>
ext Felix Fietkau wrote:
> Luciano Coelho wrote:
>
>> If rix is not found in mi->r[], i will become -1 after the loop. This value
>> is eventually used to access arrays, so we were accessing arrays with a
>> negative index, which is obviously not what we want to do. This patch fixes
>> this potential problem.
>>
>> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
>> ---
>> net/mac80211/rc80211_minstrel.c | 5 ++++-
>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
>> index b218b98..e2dd248 100644
>> --- a/net/mac80211/rc80211_minstrel.c
>> +++ b/net/mac80211/rc80211_minstrel.c
>> @@ -66,7 +66,7 @@ rix_to_ndx(struct minstrel_sta_info *mi, int rix)
>> for (i = rix; i >= 0; i--)
>> if (mi->r[i].rix == rix)
>> break;
>> - WARN_ON(mi->r[i].rix != rix);
>> + WARN_ON(i < 0 || mi->r[i].rix != rix);
>>
> I believe this line could be changed to WARN_ON(i < 0), because
> (mi->r[i].rix != rix) will never be true unless i < 0.
> Probably not that important though.
>
That's true. I'll change the code and send v2. It's not that
important, but it is code that will never be reached, so it should be
removed.
> Acked-by: Felix Fietkau <nbd@openwrt.org>
>
Thanks!
--
Cheers,
Luca.
prev parent reply other threads:[~2009-07-03 5:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-02 21:52 [PATCH] mac80211: minstrel: avoid accessing negative indices in rix_to_ndx() Luciano Coelho
2009-07-03 0:16 ` Felix Fietkau
2009-07-03 5:15 ` Luciano Coelho [this message]
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=4A4D9404.9030103@nokia.com \
--to=luciano.coelho@nokia.com \
--cc=Kalle.Valo@nokia.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.org \
--cc=nbd@openwrt.org \
--cc=vidhya.govindan@nokia.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).