ar9170: fix read & write outside array bounds
Quoted 31 lines · John W. Linville
Quoted 30 lines · Christian Lamparter
From: Dan Carpenter <[email protected]>
queue ==
__AR9170_NUM_TXQwould cause a bug on the next line.found by Smatch ( http://repo.or.cz/w/smatch.git ).
Reported-by Dan Carpenter <[email protected]>Signed-off-by Dan Carpenter <[email protected]>Signed-off-by Christian Lamparter <[email protected]>---
drivers/net/wireless/ath/ar9170/main.c +3
-2@@ -2458,13 +2458,14 @@ static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue,int ret;mutex_lock (&ar->mutex); -if ((param) && !(queue > __AR9170_NUM_TXQ)) { +if (queue < __AR9170_NUM_TXQ) {memcpy (&ar->edcf[ar9170_qos_hwmap[queue]], param,sizeof (*param)); ret =ar9170_set_qos (ar); - }else + }else { ret = -EINVAL ; + }
Quoted 5 lines
drivers/net/wireless/ath/ar9170/main.c static int ar9170_conf_tx(struct ieee80211_hw *hw, u16 queue, · line 2471
Quoted 2 lines
drivers/net/wireless/ath/ar9170/main.c +0
-0mutex_unlock (&ar->mutex);return ret;The p54 version of this patch used
hw->queuesinstead of a constant. Wouldn't that be better here?
Depends...
Other drivers like ath9k/iwlwifi use a constant _check_ as well. Having constants is always a plus for AOT compilers.
The reason why p54 does this differently and uses a variable here, is simply because the number of queues depends on the firmware revision. Users - with the old, original windows driver firmwares - have experienced serve stability problems with QoS enabled.
Regards,
Chr
________________________________________________________________
Neu: WEB.DE Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate für nur 19,99 Euro/mtl.!* http://produkte.web.de/go/02/