* [PATCH] mt76: Fix comparisons with invalid hardware key index
@ 2018-08-23 21:27 Geert Uytterhoeven
2018-08-24 8:08 ` Stanislaw Gruszka
2018-08-31 15:52 ` Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-08-23 21:27 UTC (permalink / raw)
To: Kalle Valo, David S . Miller, Matthias Brugger,
Stanislaw Gruszka, Lorenzo Bianconi
Cc: Arnd Bergmann, linux-wireless, netdev, linux-arm-kernel,
linux-mediatek, linux-kernel, Geert Uytterhoeven
With gcc 4.1.2:
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c: In function ‘mt76x0_tx’:
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c:169: warning: comparison is always true due to limited range of data type
drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c: In function ‘mt76x2_tx’:
drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c:35: warning: comparison is always true due to limited range of data type
While assigning -1 to a u8 works fine, comparing with -1 does not work
as expected.
Fix this by comparing with 0xff, like is already done in some other
places.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Compile-tested only.
---
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/tx.c b/drivers/net/wireless/mediatek/mt76/mt76x0/tx.c
index 751b49c28ae53f0f..c45d05d5aab1d207 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x0/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x0/tx.c
@@ -166,7 +166,7 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
if (sta) {
msta = (struct mt76_sta *) sta->drv_priv;
wcid = &msta->wcid;
- } else if (vif && (!info->control.hw_key && wcid->hw_key_idx != -1)) {
+ } else if (vif && (!info->control.hw_key && wcid->hw_key_idx != 0xff)) {
struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
wcid = &mvif->group_wcid;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c b/drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c
index 36afb166fa3ffd29..c0ca0df84ed8b86a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c
@@ -32,7 +32,7 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
msta = (struct mt76x2_sta *)control->sta->drv_priv;
wcid = &msta->wcid;
/* sw encrypted frames */
- if (!info->control.hw_key && wcid->hw_key_idx != -1)
+ if (!info->control.hw_key && wcid->hw_key_idx != 0xff)
control->sta = NULL;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: Fix comparisons with invalid hardware key index
2018-08-23 21:27 [PATCH] mt76: Fix comparisons with invalid hardware key index Geert Uytterhoeven
@ 2018-08-24 8:08 ` Stanislaw Gruszka
2018-08-24 8:20 ` Kalle Valo
2018-08-31 15:52 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Stanislaw Gruszka @ 2018-08-24 8:08 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Kalle Valo, David S . Miller, Matthias Brugger, Lorenzo Bianconi,
Arnd Bergmann, linux-wireless, netdev, linux-arm-kernel,
linux-mediatek, linux-kernel
On Thu, Aug 23, 2018 at 11:27:38PM +0200, Geert Uytterhoeven wrote:
> With gcc 4.1.2:
>
> drivers/net/wireless/mediatek/mt76/mt76x0/tx.c: In function ‘mt76x0_tx’:
> drivers/net/wireless/mediatek/mt76/mt76x0/tx.c:169: warning: comparison is always true due to limited range of data type
> drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c: In function ‘mt76x2_tx’:
> drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c:35: warning: comparison is always true due to limited range of data type
>
> While assigning -1 to a u8 works fine, comparing with -1 does not work
> as expected.
>
> Fix this by comparing with 0xff, like is already done in some other
> places.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Ack for mt76x0. I think Lorenzo already posted patch for mt76x2.
Thanks
Stanislaw
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: Fix comparisons with invalid hardware key index
2018-08-24 8:08 ` Stanislaw Gruszka
@ 2018-08-24 8:20 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-08-24 8:20 UTC (permalink / raw)
To: Stanislaw Gruszka
Cc: Geert Uytterhoeven, David S . Miller, Matthias Brugger,
Lorenzo Bianconi, Arnd Bergmann, linux-wireless, netdev,
linux-arm-kernel, linux-mediatek, linux-kernel
Stanislaw Gruszka <sgruszka@redhat.com> writes:
> On Thu, Aug 23, 2018 at 11:27:38PM +0200, Geert Uytterhoeven wrote:
>> With gcc 4.1.2:
>>
>> drivers/net/wireless/mediatek/mt76/mt76x0/tx.c: In function ‘mt76x0_tx’:
>> drivers/net/wireless/mediatek/mt76/mt76x0/tx.c:169: warning:
>> comparison is always true due to limited range of data type
>> drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c: In function ‘mt76x2_tx’:
>> drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c:35:
>> warning: comparison is always true due to limited range of data type
>>
>> While assigning -1 to a u8 works fine, comparing with -1 does not work
>> as expected.
>>
>> Fix this by comparing with 0xff, like is already done in some other
>> places.
>>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>
> Ack for mt76x0. I think Lorenzo already posted patch for mt76x2.
Yeah, Lorenzo's patch is here:
https://patchwork.kernel.org/patch/10570555/
As Geert's patch seems to be more complete I'm planning to take Geert's
version.
--
Kalle Valo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: Fix comparisons with invalid hardware key index
2018-08-23 21:27 [PATCH] mt76: Fix comparisons with invalid hardware key index Geert Uytterhoeven
2018-08-24 8:08 ` Stanislaw Gruszka
@ 2018-08-31 15:52 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-08-31 15:52 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: David S . Miller, Matthias Brugger, Stanislaw Gruszka,
Lorenzo Bianconi, Arnd Bergmann, linux-wireless, netdev,
linux-arm-kernel, linux-mediatek, linux-kernel,
Geert Uytterhoeven
Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> With gcc 4.1.2:
>
> drivers/net/wireless/mediatek/mt76/mt76x0/tx.c: In function ‘mt76x0_tx’:
> drivers/net/wireless/mediatek/mt76/mt76x0/tx.c:169: warning: comparison is always true due to limited range of data type
> drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c: In function ‘mt76x2_tx’:
> drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c:35: warning: comparison is always true due to limited range of data type
>
> While assigning -1 to a u8 works fine, comparing with -1 does not work
> as expected.
>
> Fix this by comparing with 0xff, like is already done in some other
> places.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Patch applied to wireless-drivers-next.git, thanks.
81c8eccc2404 mt76: Fix comparisons with invalid hardware key index
--
https://patchwork.kernel.org/patch/10574583/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-31 15:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23 21:27 [PATCH] mt76: Fix comparisons with invalid hardware key index Geert Uytterhoeven
2018-08-24 8:08 ` Stanislaw Gruszka
2018-08-24 8:20 ` Kalle Valo
2018-08-31 15:52 ` Kalle Valo
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).