From: Dan Carpenter Date: Fri, 3 May 2019 12:54:36 +0000 (+0300) Subject: mt76: Fix a signedness bug in mt7615_add_interface() X-Git-Tag: v5.4-rc1~616^2~52^2~2^2~63 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1571a0e77d8cef14227af293c6dda1464a57270;p=platform%2Fkernel%2Flinux-rpi.git 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") Signed-off-by: Dan Carpenter Signed-off-by: Felix Fietkau --- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c index 80e6b21..8d7a47d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -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;