Skip to content

Commit 1944015

Browse files
committed
mac80211: fix rate mask reset
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>
1 parent 13832ae commit 1944015

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
@@ -2950,14 +2950,14 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
29502950
continue;
29512951

29522952
for (j = 0; j < IEEE80211_HT_MCS_MASK_LEN; j++) {
2953-
if (~sdata->rc_rateidx_mcs_mask[i][j]) {
2953+
if (sdata->rc_rateidx_mcs_mask[i][j] != 0xff) {
29542954
sdata->rc_has_mcs_mask[i] = true;
29552955
break;
29562956
}
29572957
}
29582958

29592959
for (j = 0; j < NL80211_VHT_NSS_MAX; j++) {
2960-
if (~sdata->rc_rateidx_vht_mcs_mask[i][j]) {
2960+
if (sdata->rc_rateidx_vht_mcs_mask[i][j] != 0xffff) {
29612961
sdata->rc_has_vht_mcs_mask[i] = true;
29622962
break;
29632963
}

0 commit comments

Comments
 (0)