]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ath9k_htc: check for underflow in ath9k_htc_rx_msg()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 6 Nov 2015 10:01:20 +0000 (13:01 +0300)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 2 Feb 2016 19:27:47 +0000 (19:27 +0000)
commit 3a318426e09a9c9266fe6440842e11238f640a20 upstream.

We check for overflow here, but we don't check for underflow so it
causes a static checker warning.

Fixes: fb9987d0f748 ('ath9k_htc: Support for AR9271 chipset.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/net/wireless/ath/ath9k/htc_hst.c

index a0ff5b6370543809d8b715ec098986732d8f7809..93a86e24ff30b9a119b0afc47ac3215a22b79f78 100644 (file)
@@ -415,7 +415,7 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
                return;
        }
 
-       if (epid >= ENDPOINT_MAX) {
+       if (epid < 0 || epid >= ENDPOINT_MAX) {
                if (pipe_id != USB_REG_IN_PIPE)
                        dev_kfree_skb_any(skb);
                else