Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2835758pxb; Fri, 12 Feb 2021 02:36:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4h7A537G8EALf4fU6ibTQTr+QnKqektSXZjQF4wc75+zGRINRKCoOQy338eKxplegtZV9 X-Received: by 2002:a50:ff0d:: with SMTP id a13mr2542324edu.321.1613126170080; Fri, 12 Feb 2021 02:36:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613126170; cv=none; d=google.com; s=arc-20160816; b=ETyrQ2nbJnBb5hbDBPCOrWapZ3N1pFtyEQ+05c/J/SQVZlJqsHFWaMVMQZBqJlutm1 hw1gfEHOdvZuriBIsCHhoF0sVBPE/kYKxtelhQFUXpys9dVpfoPI+Pli+Z6q3Taq9vND LBZJYPlye3tXOYSBD/FZOCLhAKsXcmrfitzcmHf7jRSbY46lf6Xkfl6UU1i0fRNF5Zgp HUFSGrXpEUnKdO7oCKEBL6xV2DvDpHtv608bVl82QA4qh4lBUTICrIBsl/MB62W2JJF1 gcWlI8p520p2gIqNGldSOxpnFLW7zCvIltFojtwB4KVB+zcgDhEha9x9xQYKtx7Ksb6T d8PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=m53Gvg3XWHBy7d57jXxJP2gPpec4cSOz9QA8td3jB64=; b=jjGY+RhgLDIrpWthCxyQXUJSPku7OCyJjxfj/5atYcgMcFcVEsxkXj++X7vhJ6DJHv 7UuzwBL2/kJZ6emRIgvzgvmh+A2INEVJBMtyRbpYGG594dRPFzub/pB4Kt/P/R1jxuG/ AtQgZGgFljIHCMlZyHAGJoBXi9yJsZggQOmdZrJiQ7rBZc20hNhUNZ/xyHC/sviC0O8g r8a+dCdH4pyDSyQKSpHE/+YfTA3UCZuzA5vGiCbXC3pPGGb91pCI9r8BfMuveAnqYLmq C0odAwasVB+9WJtiW4qzsC4munhNDTrvhlFNmgW6v8b62LCPe0rPlA/pRNXxI6aPO0el PHeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si5852605eje.617.2021.02.12.02.35.45; Fri, 12 Feb 2021 02:36:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230125AbhBLKfG (ORCPT + 99 others); Fri, 12 Feb 2021 05:35:06 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:52373 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbhBLKfD (ORCPT ); Fri, 12 Feb 2021 05:35:03 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lAVmF-0001yo-TT; Fri, 12 Feb 2021 10:34:19 +0000 Subject: Re: [PATCH] mac80211: fix rate mask reset To: Johannes Berg , linux-wireless@vger.kernel.org Cc: Johannes Berg References: <20210212112213.36b38078f569.I8546a20c80bc1669058eb453e213630b846e107b@changeid> From: Colin Ian King Message-ID: <9a1b0da8-d5fb-1101-3dba-45c488821b61@canonical.com> Date: Fri, 12 Feb 2021 10:34:19 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210212112213.36b38078f569.I8546a20c80bc1669058eb453e213630b846e107b@changeid> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 12/02/2021 10:22, Johannes Berg wrote: > From: Johannes Berg > > 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 > Fixes: 2ffbe6d33366 ("mac80211: fix and optimize MCS mask handling") > Fixes: b119ad6e726c ("mac80211: add rate mask logic for vht rates") > Signed-off-by: Johannes Berg > --- > net/mac80211/cfg.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c > index c4c70e30ad7f..68a0de02b561 100644 > --- a/net/mac80211/cfg.c > +++ b/net/mac80211/cfg.c > @@ -2950,14 +2950,14 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, > continue; > > 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; > break; > } > } > > 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; > break; > } > Looks good to me, thanks Johannes. Reviewed-by: Colin Ian King