aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Ian King <[email protected]>2019-05-01 15:19:45 +0100
committerKalle Valo <[email protected]>2019-05-02 17:58:15 +0300
commitb85bd9a14c4b2722dc8764acdcce9b503e638760 (patch)
treef831ee01d0382cbf4f4c37ecc2d122bac74fa87e
parent5a489b99ecbc79ff83513f25a8f0d56ca6513cac (diff)
rtw88: fix shift of more than 32 bits of a integer
Currently the shift of an integer value more than 32 bits can occur when nss is more than 32. Fix this by making the integer constants unsigned long longs before shifting and bit-wise or'ing with the u64 ra_mask to avoid the undefined shift behaviour. Addresses-Coverity: ("Bad shift operation") Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
-rw-r--r--drivers/net/wireless/realtek/rtw88/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index 9893e5e297e3..6304082361a7 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -363,13 +363,13 @@ static u64 get_vht_ra_mask(struct ieee80211_sta *sta)
vht_mcs_cap = mcs_map & 0x3;
switch (vht_mcs_cap) {
case 2: /* MCS9 */
- ra_mask |= 0x3ff << nss;
+ ra_mask |= 0x3ffULL << nss;
break;
case 1: /* MCS8 */
- ra_mask |= 0x1ff << nss;
+ ra_mask |= 0x1ffULL << nss;
break;
case 0: /* MCS7 */
- ra_mask |= 0x0ff << nss;
+ ra_mask |= 0x0ffULL << nss;
break;
default:
break;