提交 b85bd9a1 编写于 作者: C Colin Ian King 提交者: Kalle Valo

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: e3037485 ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
上级 5a489b99
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册