Skip to contentSkip to conversation

ath6kl: Initialize a variable properly

PATCH In review Sujith Manoharan 2 participants 3 messages Jan 10, 2012 – Jan 12, 2012 Atheros ATH6KL wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 ath6kl: Initialize a variable properly

This prevents 'comp_pktq' from being used in an
incorrect manner.

---
 drivers/net/wireless/ath/ath6kl/htc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath6kl/htc.c +1 -0
index b017022..2d72190 100644
@@ -2062,6 +2062,7 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
 	enum htc_endpoint_id id;
 	int n_fetched = 0;
 
+	INIT_LIST_HEAD(&comp_pktq);
 	*num_pkts = 0;
 
 	/*
Signature · 1 line
1.7.8.3
#1 lore raw
Quoted 13 lines · Sujith Manoharan

This prevents 'comp_pktq' from being used in an
incorrect manner.

---
 drivers/net/wireless/ath/ath6kl/htc.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/net/wireless/ath/ath6kl/htc.c +0 -0
index b017022..2d72190 100644

drivers/net/wireless/ath/ath6kl/htc.c int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target, · line 2065

Quoted 4 lines
drivers/net/wireless/ath/ath6kl/htc.c +1 -0
@@ -2062,6 +2062,7 @@ int ath6kl_htc_rxmsg_pending_handler(struct htc_target *target,
 	enum htc_endpoint_id id;
 	int n_fetched = 0;
 
+	INIT_LIST_HEAD(&comp_pktq);

But there's also the same init later in the function, inside the while loop:

		INIT_LIST_HEAD(&rx_pktq);
		INIT_LIST_HEAD(&comp_pktq);

Is this intentional?

Kalle

#2 lore raw
Quoted 6 lines · Kalle Valo

But there's also the same init later in the function, inside the while loop:

		INIT_LIST_HEAD(&rx_pktq);
		INIT_LIST_HEAD(&comp_pktq);

Is this intentional?

I think so.

If we break out of the loop on the first iteration because of the condition "if (id >= ENDPOINT_MAX)", then comp_pktq ends up being used without having been initialized.

Sujith