Skip to contentSkip to conversation

mt76: Fix a signedness bug in mt7615_add_interface()

PATCH Applied Dan Carpenter 2 participants 2 messages May 3, 2019 – May 11, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mt76: Fix a signedness bug in mt7615_add_interface()

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 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
---
 drivers/net/wireless/mediatek/mt76/mt7615/main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/main.c +3 -2
index 80e6b211f60b..8d7a47d1b205 100644
@@ -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;
Signature · 1 line
2.18.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Dan Carpenter

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 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")

Applied, thanks.

- Felix