Commit 1944015f authored by Johannes Berg's avatar Johannes Berg

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: default avatarColin Ian King <colin.king@canonical.com>
Fixes: 2ffbe6d3 ("mac80211: fix and optimize MCS mask handling")
Fixes: b119ad6e ("mac80211: add rate mask logic for vht rates")
Reviewed-by: default avatarColin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210212112213.36b38078f569.I8546a20c80bc1669058eb453e213630b846e107b@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 13832ae2
...@@ -2950,14 +2950,14 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, ...@@ -2950,14 +2950,14 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
continue; continue;
for (j = 0; j < IEEE80211_HT_MCS_MASK_LEN; j++) { for (j = 0; j < IEEE80211_HT_MCS_MASK_LEN; j++) {
if (~sdata->rc_rateidx_mcs_mask[i][j]) { if (sdata->rc_rateidx_mcs_mask[i][j] != 0xff) {
sdata->rc_has_mcs_mask[i] = true; sdata->rc_has_mcs_mask[i] = true;
break; break;
} }
} }
for (j = 0; j < NL80211_VHT_NSS_MAX; j++) { for (j = 0; j < NL80211_VHT_NSS_MAX; j++) {
if (~sdata->rc_rateidx_vht_mcs_mask[i][j]) { if (sdata->rc_rateidx_vht_mcs_mask[i][j] != 0xffff) {
sdata->rc_has_vht_mcs_mask[i] = true; sdata->rc_has_vht_mcs_mask[i] = true;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment