]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mt76: Fix a signedness bug in mt7615_add_interface()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 3 May 2019 12:54:36 +0000 (15:54 +0300)
committerFelix Fietkau <nbd@nbd.name>
Tue, 25 Jun 2019 10:55:25 +0000 (12:55 +0200)
The problem is that "mvif->omac_idx" is a u8 so it can't be negative
and the error handling won't work.  The get_omac_idx() function returns
-1 on error.

Fixes: 09301c7b1225 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7615/main.c

index 80e6b211f60b8f5ca15c6db16e94f73b40b226f5..8d7a47d1b20553a750e95b124557d03ae5e1138a 100644 (file)
@@ -77,11 +77,12 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,
                goto out;
        }
 
-       mvif->omac_idx = get_omac_idx(vif->type, dev->omac_mask);
-       if (mvif->omac_idx < 0) {
+       idx = get_omac_idx(vif->type, dev->omac_mask);
+       if (idx < 0) {
                ret = -ENOSPC;
                goto out;
        }
+       mvif->omac_idx = idx;
 
        /* TODO: DBDC support. Use band 0 and wmm 0 for now */
        mvif->band_idx = 0;