netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath10k: htt_rx: Fix signedness bug in ath10k_update_per_peer_tx_stats
@ 2018-10-05 18:42 Gustavo A. R. Silva
  2018-10-05 19:09 ` Ben Greear
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Gustavo A. R. Silva @ 2018-10-05 18:42 UTC (permalink / raw)
  To: Kalle Valo, David S. Miller
  Cc: netdev, linux-wireless, linux-kernel, ath10k, Gustavo A. R. Silva

Currently, the error handling for the call to function
ath10k_get_legacy_rate_idx() doesn't work because
*rate_idx* is of type u8 (8 bits, unsigned), which
makes it impossible for it to hold a value less
than 0.

Fix this by changing the type of variable *rate_idx*
to s8 (8 bits, signed).

Addresses-Coverity-ID: 1473914 ("Unsigned compared against 0")
Fixes: 0189dbd71cbd ("ath10k: get the legacy rate index to update the txrate table")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index f240525..edd0e74 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -2753,7 +2753,8 @@ ath10k_update_per_peer_tx_stats(struct ath10k *ar,
 				struct ath10k_per_peer_tx_stats *peer_stats)
 {
 	struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv;
-	u8 rate = 0, rate_idx = 0, sgi;
+	u8 rate = 0, sgi;
+	s8 rate_idx = 0;
 	struct rate_info txrate;
 
 	lockdep_assert_held(&ar->data_lock);
-- 
2.7.4

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

end of thread, other threads:[~2018-10-13 18:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-05 18:42 [PATCH] ath10k: htt_rx: Fix signedness bug in ath10k_update_per_peer_tx_stats Gustavo A. R. Silva
2018-10-05 19:09 ` Ben Greear
2018-10-05 19:14   ` Gustavo A. R. Silva
     [not found]     ` <dd75a8aa-b87c-e325-cc1d-a0efe3664a32-L1vi/lXTdts+Va1GwOuvDg@public.gmane.org>
2018-10-05 19:15       ` Gustavo A. R. Silva
2018-10-08  6:38         ` Anilkumar Kolli
2018-10-09 19:19           ` Gustavo A. R. Silva
2018-10-13 17:23 ` Kalle Valo
2018-10-13 17:23 ` Kalle Valo
     [not found] ` <20181013172330.1CC8E60BFE@smtp.codeaurora.org>
2018-10-13 18:26   ` Gustavo A. R. Silva

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