From: Denis Kirjanov <dkirjanov@kernel.org>
To: linville@tuxdriver.com
Cc: proski@gnu.org, hermes@gibson.dropbear.id.au,
davem@davemloft.net, linux-wireless@vger.kernel.org,
orinoco-devel@lists.sourceforge.net, netdev@vger.kernel.org
Subject: [PATCH] orinoco: Fix walking past the end of the buffer
Date: Wed, 11 Aug 2010 20:32:16 +0000 [thread overview]
Message-ID: <20100811203216.GA25168@hera.kernel.org> (raw)
Fix walking past the end of the bitrate_table array
in the case when the loop counter == BITRATE_TABLE_SIZE.
Mark bitrate as invalid in this case for the orinoco_ioctl_setrate()
Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
---
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index 077baa8..191bc03 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -765,9 +765,12 @@ int orinoco_hw_get_act_bitrate(struct orinoco_private *priv, int *bitrate)
if (bitrate_table[i].intersil_txratectrl == val)
break;
- if (i >= BITRATE_TABLE_SIZE)
+ if (i >= BITRATE_TABLE_SIZE) {
printk(KERN_INFO "%s: Unable to determine current bitrate (0x%04hx)\n",
priv->ndev->name, val);
+ *bitrate = 100001; /* Mark as invalid */
+ break;
+ }
*bitrate = bitrate_table[i].bitrate * 100000;
break;
next reply other threads:[~2010-08-11 20:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 20:32 Denis Kirjanov [this message]
2010-08-14 9:45 ` [PATCH] orinoco: Fix walking past the end of the buffer Dave Kilroy
-- strict thread matches above, loose matches on Subject: below --
2010-08-21 11:08 David Kilroy
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=20100811203216.GA25168@hera.kernel.org \
--to=dkirjanov@kernel.org \
--cc=davem@davemloft.net \
--cc=hermes@gibson.dropbear.id.au \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
--cc=orinoco-devel@lists.sourceforge.net \
--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;
as well as URLs for NNTP newsgroup(s).