Skip to content

Commit f865127

Browse files
jmberg-intelgregkh
authored andcommitted
mac80211: fix rate mask reset
[ Upstream commit 1944015 ] Coverity reported the strange "if (~...)" condition that's always true. It suggested that ! was intended instead of ~, but upon further analysis I'm convinced that what really was intended was a comparison to 0xff/0xffff (in HT/VHT cases respectively), since this indicates that all of the rates are enabled. Change the comparison accordingly. I'm guessing this never really mattered because a reset to not having a rate mask is basically equivalent to having a mask that enables all rates. Reported-by: Colin Ian King <colin.king@canonical.com> Fixes: 2ffbe6d ("mac80211: fix and optimize MCS mask handling") Fixes: b119ad6 ("mac80211: add rate mask logic for vht rates") Reviewed-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210212112213.36b38078f569.I8546a20c80bc1669058eb453e213630b846e107b@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 48d0b54 commit f865127

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎net/mac80211/cfg.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2961,14 +2961,14 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
29612961
continue;
29622962

29632963
for (j = 0; j < IEEE80211_HT_MCS_MASK_LEN; j++) {
2964-
if (~sdata->rc_rateidx_mcs_mask[i][j]) {
2964+
if (sdata->rc_rateidx_mcs_mask[i][j] != 0xff) {
29652965
sdata->rc_has_mcs_mask[i] = true;
29662966
break;
29672967
}
29682968
}
29692969

29702970
for (j = 0; j < NL80211_VHT_NSS_MAX; j++) {
2971-
if (~sdata->rc_rateidx_vht_mcs_mask[i][j]) {
2971+
if (sdata->rc_rateidx_vht_mcs_mask[i][j] != 0xffff) {
29722972
sdata->rc_has_vht_mcs_mask[i] = true;
29732973
break;
29742974
}

0 commit comments

Comments
 (0)