linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: ath9k: fix possible integer overflow in ath9k_get_et_stats()
@ 2024-07-25 11:17 Dmitry Kandybka
  2024-07-30  9:46 ` Toke Høiland-Jørgensen
  2024-08-01 14:59 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Kandybka @ 2024-07-25 11:17 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: linux-wireless, Dmitry Antipov

In 'ath9k_get_et_stats()', promote TX stats counters to 'u64'
to avoid possible integer overflow. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Kandybka <d.kandybka@gmail.com>
---
 drivers/net/wireless/ath/ath9k/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index d84e3ee7b5d9..886a102e5b02 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -1325,11 +1325,11 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw,
 	struct ath_softc *sc = hw->priv;
 	int i = 0;
 
-	data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_pkts_all +
+	data[i++] = ((u64)sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_pkts_all +
 		     sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_pkts_all +
 		     sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_pkts_all +
 		     sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_pkts_all);
-	data[i++] = (sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_bytes_all +
+	data[i++] = ((u64)sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BE)].tx_bytes_all +
 		     sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_BK)].tx_bytes_all +
 		     sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VI)].tx_bytes_all +
 		     sc->debug.stats.txstats[PR_QNUM(IEEE80211_AC_VO)].tx_bytes_all);
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath9k: fix possible integer overflow in ath9k_get_et_stats()
  2024-07-25 11:17 [PATCH] wifi: ath9k: fix possible integer overflow in ath9k_get_et_stats() Dmitry Kandybka
@ 2024-07-30  9:46 ` Toke Høiland-Jørgensen
  2024-08-01 14:59 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-07-30  9:46 UTC (permalink / raw)
  To: Dmitry Kandybka; +Cc: linux-wireless, Dmitry Antipov

Dmitry Kandybka <d.kandybka@gmail.com> writes:

> In 'ath9k_get_et_stats()', promote TX stats counters to 'u64'
> to avoid possible integer overflow. Compile tested only.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Dmitry Kandybka <d.kandybka@gmail.com>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath9k: fix possible integer overflow in ath9k_get_et_stats()
  2024-07-25 11:17 [PATCH] wifi: ath9k: fix possible integer overflow in ath9k_get_et_stats() Dmitry Kandybka
  2024-07-30  9:46 ` Toke Høiland-Jørgensen
@ 2024-08-01 14:59 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2024-08-01 14:59 UTC (permalink / raw)
  To: Dmitry Kandybka
  Cc: Toke Høiland-Jørgensen, linux-wireless, Dmitry Antipov

Dmitry Kandybka <d.kandybka@gmail.com> wrote:

> In 'ath9k_get_et_stats()', promote TX stats counters to 'u64'
> to avoid possible integer overflow. Compile tested only.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Kandybka <d.kandybka@gmail.com>
> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

3f66f2670309 wifi: ath9k: fix possible integer overflow in ath9k_get_et_stats()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20240725111743.14422-1-d.kandybka@gmail.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-01 14:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25 11:17 [PATCH] wifi: ath9k: fix possible integer overflow in ath9k_get_et_stats() Dmitry Kandybka
2024-07-30  9:46 ` Toke Høiland-Jørgensen
2024-08-01 14:59 ` Kalle Valo

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).