]> git.baikalelectronics.ru Git - kernel.git/commitdiff
wil6210: fix unsigned cid comparison with >= 0
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Wed, 29 Aug 2018 17:50:18 +0000 (12:50 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 6 Sep 2018 15:56:14 +0000 (18:56 +0300)
The comparison of cid >= 0 is always true because cid is of type u8
(8 bits, unsigned).

Fix this by removing such comparison and updating the type of
variable cid to u8 in the caller function.

Addresses-Coverity-ID: 1473079 ("Unsigned compared against 0")
Fixes: a2194b0f6007 ("wil6210: add FT roam support for AP and station")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/wil6210/wil6210.h
drivers/net/wireless/ath/wil6210/wmi.c

index cf6a69198b5d2c144e0ed252ac5bec92cbcbc202..abb82018d3b4344121759ee5f11c100992cbe9d0 100644 (file)
@@ -455,7 +455,7 @@ static inline void parse_cidxtid(u8 cidxtid, u8 *cid, u8 *tid)
  */
 static inline bool wil_cid_valid(u8 cid)
 {
-       return (cid >= 0 && cid < WIL6210_MAX_CID);
+       return cid < WIL6210_MAX_CID;
 }
 
 struct wil6210_mbox_ring {
index c3ad8e4df3ec94ffad4dd18703a9f3a443ed436e..4859f0e43658ce00d8f4c7990dc6ef23d0357dc0 100644 (file)
@@ -1177,7 +1177,7 @@ static void wmi_evt_ring_en(struct wil6210_vif *vif, int id, void *d, int len)
        u8 vri = evt->ring_index;
        struct wireless_dev *wdev = vif_to_wdev(vif);
        struct wil_sta_info *sta;
-       int cid;
+       u8 cid;
        struct key_params params;
 
        wil_dbg_wmi(wil, "Enable vring %d MID %d\n", vri, vif->mid);