From: Dan Carpenter <error27@gmail.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [patch 2/9] ath9k: range checking issues in htc_hst.c
Date: Sat, 8 May 2010 18:22:01 +0200 [thread overview]
Message-ID: <20100508162201.GN27064@bicker> (raw)
The original code had ENDPOINT_MAX and HST_ENDPOINT_MAX switched.
Also the first loop was off by one, it started past the end of the array
and went down to 1 instead of going down to 0. The test at the end of
the loop to see if we exited via a break wasn't right because
"tmp_endpoint" is always non-null here.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index 7bf6ce1..0c062d0 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -116,7 +116,7 @@ static void htc_process_conn_rsp(struct htc_target *target,
max_msglen = be16_to_cpu(svc_rspmsg->max_msg_len);
endpoint = &target->endpoint[epid];
- for (tepid = ENDPOINT_MAX; tepid > ENDPOINT0; tepid--) {
+ for (tepid = HST_ENDPOINT_MAX - 1; tepid >= ENDPOINT0; tepid--) {
tmp_endpoint = &target->endpoint[tepid];
if (tmp_endpoint->service_id == service_id) {
tmp_endpoint->service_id = 0;
@@ -124,7 +124,7 @@ static void htc_process_conn_rsp(struct htc_target *target,
}
}
- if (!tmp_endpoint)
+ if (tepid < ENDPOINT0)
return;
endpoint->service_id = service_id;
@@ -297,7 +297,7 @@ void htc_stop(struct htc_target *target)
enum htc_endpoint_id epid;
struct htc_endpoint *endpoint;
- for (epid = ENDPOINT0; epid <= ENDPOINT_MAX; epid++) {
+ for (epid = ENDPOINT0; epid < HST_ENDPOINT_MAX; epid++) {
endpoint = &target->endpoint[epid];
if (endpoint->service_id != 0)
target->hif->stop(target->hif_dev, endpoint->ul_pipeid);
@@ -309,7 +309,7 @@ void htc_start(struct htc_target *target)
enum htc_endpoint_id epid;
struct htc_endpoint *endpoint;
- for (epid = ENDPOINT0; epid <= ENDPOINT_MAX; epid++) {
+ for (epid = ENDPOINT0; epid < HST_ENDPOINT_MAX; epid++) {
endpoint = &target->endpoint[epid];
if (endpoint->service_id != 0)
target->hif->start(target->hif_dev,
@@ -377,7 +377,7 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
htc_hdr = (struct htc_frame_hdr *) skb->data;
epid = htc_hdr->endpoint_id;
- if (epid >= ENDPOINT_MAX) {
+ if (epid >= HST_ENDPOINT_MAX) {
if (pipe_id != USB_REG_IN_PIPE)
dev_kfree_skb_any(skb);
else
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: "Luis R. Rodriguez" <lrodriguez@atheros.com>
Cc: Jouni Malinen <jmalinen@atheros.com>,
Sujith Manoharan <Sujith.Manoharan@atheros.com>,
Vasanthakumar Thiagarajan <vasanth@atheros.com>,
Senthil Balasubramanian <senthilkumar@atheros.com>,
"John W. Linville" <linville@tuxdriver.com>,
Ming Lei <tom.leiming@gmail.com>,
linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org
Subject: [patch 2/9] ath9k: range checking issues in htc_hst.c
Date: Sat, 8 May 2010 18:22:01 +0200 [thread overview]
Message-ID: <20100508162201.GN27064@bicker> (raw)
The original code had ENDPOINT_MAX and HST_ENDPOINT_MAX switched.
Also the first loop was off by one, it started past the end of the array
and went down to 1 instead of going down to 0. The test at the end of
the loop to see if we exited via a break wasn't right because
"tmp_endpoint" is always non-null here.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c
index 7bf6ce1..0c062d0 100644
--- a/drivers/net/wireless/ath/ath9k/htc_hst.c
+++ b/drivers/net/wireless/ath/ath9k/htc_hst.c
@@ -116,7 +116,7 @@ static void htc_process_conn_rsp(struct htc_target *target,
max_msglen = be16_to_cpu(svc_rspmsg->max_msg_len);
endpoint = &target->endpoint[epid];
- for (tepid = ENDPOINT_MAX; tepid > ENDPOINT0; tepid--) {
+ for (tepid = HST_ENDPOINT_MAX - 1; tepid >= ENDPOINT0; tepid--) {
tmp_endpoint = &target->endpoint[tepid];
if (tmp_endpoint->service_id == service_id) {
tmp_endpoint->service_id = 0;
@@ -124,7 +124,7 @@ static void htc_process_conn_rsp(struct htc_target *target,
}
}
- if (!tmp_endpoint)
+ if (tepid < ENDPOINT0)
return;
endpoint->service_id = service_id;
@@ -297,7 +297,7 @@ void htc_stop(struct htc_target *target)
enum htc_endpoint_id epid;
struct htc_endpoint *endpoint;
- for (epid = ENDPOINT0; epid <= ENDPOINT_MAX; epid++) {
+ for (epid = ENDPOINT0; epid < HST_ENDPOINT_MAX; epid++) {
endpoint = &target->endpoint[epid];
if (endpoint->service_id != 0)
target->hif->stop(target->hif_dev, endpoint->ul_pipeid);
@@ -309,7 +309,7 @@ void htc_start(struct htc_target *target)
enum htc_endpoint_id epid;
struct htc_endpoint *endpoint;
- for (epid = ENDPOINT0; epid <= ENDPOINT_MAX; epid++) {
+ for (epid = ENDPOINT0; epid < HST_ENDPOINT_MAX; epid++) {
endpoint = &target->endpoint[epid];
if (endpoint->service_id != 0)
target->hif->start(target->hif_dev,
@@ -377,7 +377,7 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
htc_hdr = (struct htc_frame_hdr *) skb->data;
epid = htc_hdr->endpoint_id;
- if (epid >= ENDPOINT_MAX) {
+ if (epid >= HST_ENDPOINT_MAX) {
if (pipe_id != USB_REG_IN_PIPE)
dev_kfree_skb_any(skb);
else
next reply other threads:[~2010-05-08 16:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-08 16:22 Dan Carpenter [this message]
2010-05-08 16:22 ` [patch 2/9] ath9k: range checking issues in htc_hst.c Dan Carpenter
2010-05-10 4:37 ` [ath9k-devel] " Sujith
2010-05-10 4:37 ` Sujith
2010-05-10 10:23 ` [ath9k-devel] " Dan Carpenter
2010-05-10 10:23 ` Dan Carpenter
2010-05-10 10:50 ` [ath9k-devel] " Sujith
2010-05-10 10:50 ` Sujith
2010-05-10 12:17 ` [ath9k-devel] " Pavel Roskin
2010-05-10 12:17 ` Pavel Roskin
2010-05-11 5:50 ` Sujith.Manoharan at atheros.com
2010-05-11 5:50 ` Sujith.Manoharan
2010-05-11 9:29 ` [ath9k-devel] " Dan Carpenter
2010-05-11 9:29 ` Dan Carpenter
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=20100508162201.GN27064@bicker \
--to=error27@gmail.com \
--cc=ath9k-devel@lists.ath9k.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.