Skip to content

Commit

Permalink
mt76: Fix a signedness bug in mt7615_add_interface()
Browse files Browse the repository at this point in the history
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")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
Dan Carpenter authored and nbd168 committed May 11, 2019
1 parent 2cb4683 commit b4ceb9f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mt7615/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b4ceb9f

Please sign in to comment.