* [PATCH] mt76: Fix a signedness bug in mt7615_add_interface()
@ 2019-05-03 12:54 Dan Carpenter
2019-05-11 13:28 ` Felix Fietkau
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-05-03 12:54 UTC (permalink / raw)
To: Felix Fietkau, Ryder Lee
Cc: Lorenzo Bianconi, Roy Luo, Kalle Valo, Matthias Brugger,
linux-wireless, linux-mediatek, kernel-janitors
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 <dan.carpenter@oracle.com>
---
drivers/net/wireless/mediatek/mt76/mt7615/main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 80e6b211f60b..8d7a47d1b205 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;
--
2.18.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mt76: Fix a signedness bug in mt7615_add_interface()
2019-05-03 12:54 [PATCH] mt76: Fix a signedness bug in mt7615_add_interface() Dan Carpenter
@ 2019-05-11 13:28 ` Felix Fietkau
0 siblings, 0 replies; 2+ messages in thread
From: Felix Fietkau @ 2019-05-11 13:28 UTC (permalink / raw)
To: Dan Carpenter, Ryder Lee
Cc: Lorenzo Bianconi, Roy Luo, Kalle Valo, Matthias Brugger,
linux-wireless, linux-mediatek, kernel-janitors
On 2019-05-03 14:54, Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>
Applied, thanks.
- Felix
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-11 13:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-03 12:54 [PATCH] mt76: Fix a signedness bug in mt7615_add_interface() Dan Carpenter
2019-05-11 13:28 ` Felix Fietkau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).