Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3405997pxf; Mon, 29 Mar 2021 01:03:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxi9Djca6U7c1gXJOd8W2+s6F0HCmYGjoi1/jIJJsl7yK+CdQyEqXWuqMut/jNjhc6zpEGB X-Received: by 2002:a17:906:e119:: with SMTP id gj25mr27266091ejb.509.1617005023280; Mon, 29 Mar 2021 01:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617005023; cv=none; d=google.com; s=arc-20160816; b=OourTV2Er+wwu8n9mjlKoSnjSXsncm+o+bmCxWW4sUo6fnv5A0yzXuKpiPpqjCrHi/ BVExcaQxUOY7KxmRsh+9LSNfo9LCCXjCf8IJ058u03jDbzQ0r1683UDxIPYmSQSGsg84 bqMe+aUQM8SJAU+kytQ2VUZeR7M4+qN2hYCCUR1EqeCZf8tstgmAhrHJsj9MjT5OU1wv qhSUc4aHS0YExQjHdYjxgFqykALN5wHV5DVslmJXwVy1k0wsujju7D+nMuXyM2tyMA9G bLGOnqVNkRbMz32gN9kuJlA2PYR6nZHAlQwQccXECnAtcr5QRefCTZDlIpGP6QGj8tpX lnng== 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=lXHpbo9JI13IG/BGiH1ynBNU2fkbPexYuZGgFOk1Aeg=; b=fdLxIdd1MxBJ5B6lVQBJg3pS+7SikqelLy2v3D5UUBPaar85+vI8cWpoOi6cp79Sbo 8sfZSyH8mImqTsNiPt9P77aCqvpd6UWNqMh0ttPQ+D0tXx6PCR5oIMbivqLwdQA3jmh4 FqgAetNB1KGyI4jLCuqWBV3xaLRWdC7FIqKFBVvcZxRH9eNYnDBRp64JUDqKqNA8pMeZ 8bW0VhtVmF/PhKyH9/SKp485ciXK5z25FiVlGuPbIrK2SBrDXy+ElusHG31s9ZT7QbD8 T2cJvREu+PaMGxJ4tFmwsrBEya9ZeUVYXGnBPMtKcdkrJDCMIc8y5rdIYpWehSJ9PbG1 D1AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=B8hBlXn8; 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 el21si11973026ejc.603.2021.03.29.01.03.19; Mon, 29 Mar 2021 01:03:43 -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=B8hBlXn8; 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 S231929AbhC2ICW (ORCPT + 99 others); Mon, 29 Mar 2021 04:02:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:43728 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231751AbhC2IBl (ORCPT ); Mon, 29 Mar 2021 04:01:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CFE6B61974; Mon, 29 Mar 2021 08:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617004901; bh=25UboA02eXndeDnz59te/9bC4cvJyc6s1kdDpTMWjFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B8hBlXn8dEkUHKfQbs+pj0tneYKrYdeAYTqNiaOASPoiy1u46MiU0ZeumBaKD/MEY 05K3/LYmKrVjH4xqrp+XlrDaopuUiprQAZL8AlbrQi4gSDyTVA5ALjddLxWWLI/l43 QSXkR+G7Acet9a4ggQjX/bn0NGP2Se7x8by25+9Y= 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 4.4 27/33] mac80211: fix rate mask reset Date: Mon, 29 Mar 2021 09:58:12 +0200 Message-Id: <20210329075606.132283469@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075605.290845195@linuxfoundation.org> References: <20210329075605.290845195@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 8360fda24bca..eac20f4ab924 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2448,14 +2448,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