Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3489577pxf; Mon, 29 Mar 2021 03:48:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSTRAOLcZQck4PN2x6QtGsvuLeZwd9Q2t9NDvRUGctu0l60FMMNwU/EeOxuSIyJaN1uVCt X-Received: by 2002:aa7:cf90:: with SMTP id z16mr27804460edx.273.1617014912444; Mon, 29 Mar 2021 03:48:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617014912; cv=none; d=google.com; s=arc-20160816; b=bD5lnYVO/56U99uPJlF4l76lk8k5nVW3Cq5IbHaASnUIDvLO3N/v956cNw7zTipT1K cg5tKr1t9mLfPJa5vpgCVlKyJKsuMpIMk0MKjofKeEXnquWQb6XKOBwCwGdG/VG5iY5L CwrxneJA/b2f1KXhw3vpfZYs9HbpeZRQlsnCYh4wxJay/IJ13VGZS+RLQX7MJhB5r4FP tqJxfICvELuKPs0m5aOn/cVLZl9ELbqfd7VvypThos1kYFCMs9wWecyByc/ZCbGKPkb6 aOClGzjdfVTmbILGhd8kzl2FmiB/zsg0kA/kH8/Us+EuSM45qx9lAOoDp/bqGVc3w0jB 2vJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=obtaAi2IQFgsjgzkpS9Rdk6+w3YBTpEJA3rHUXwyoxs=; b=WJMEHDCNZSkfIW7V6zYl/ZzplqZy7tvxO01vHZhGtmXWs1Pwm980VBAXgaEUzVd3Eh dbt3yzh5xYXe6S8y/9jkGz/T2WWpD0VKMX5dn1fWwJjFyay3X3QYNCoRsHdNtgg6JC/P hAjtwuBZ9mmbKDYiKJCEBzhwNvgr5sFwa+prOdDFJgKo+CLIDymToPQqUb3irxH7vS4u 3cbdf+DKiyu1JsN7s6jsDnNM5mMgLpCc1mEtrjBOdGceIUl8+qE1faxvbitktElqYD5O uDTnYQrCk5XfYJll3I956GfDua2K5l9mFR212hbhscCeVG+zKdqf+TJNcudWdLBz/0EU igkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=orrk2BT8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si12826398edt.289.2021.03.29.03.48.09; Mon, 29 Mar 2021 03:48:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=orrk2BT8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234315AbhC2Igl (ORCPT + 99 others); Mon, 29 Mar 2021 04:36:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:39270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233778AbhC2IWZ (ORCPT ); Mon, 29 Mar 2021 04:22:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BCE276044F; Mon, 29 Mar 2021 08:22:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006145; bh=UEQoMXZ6WL4a5lcnMnICIkdCGCryPENNnGQhxaMdqrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=orrk2BT88LizM5aQe7WTw9sDE1KIt+1Vedlj/F8mgKK64bhAssE+3Mmx0e+0X63Nq 3gp/MW3vKnmVxD2YmRXIsNyv98AYULeV74TSWBuamVNmkG0aPZlKjSoUmSyq8iQJ79 TTFEl4k1npZ1ckywEBDZg1zNO6oBXVlJkSUTyX2s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Johannes Berg , Sasha Levin Subject: [PATCH 5.10 133/221] mac80211: fix rate mask reset Date: Mon, 29 Mar 2021 09:57:44 +0200 Message-Id: <20210329075633.630474453@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg [ Upstream commit 1944015fe9c1d9fa5e9eb7ffbbb5ef8954d6753b ] 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") Reviewed-by: Colin Ian King Link: https://lore.kernel.org/r/20210212112213.36b38078f569.I8546a20c80bc1669058eb453e213630b846e107b@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- 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 7276e66ae435..2bf6271d9e3f 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2961,14 +2961,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; } -- 2.30.1