summaryrefslogtreecommitdiff
path: root/net/wireless
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-08-31 11:10:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-10 08:53:19 +0200
commitb699bcb6c809123b0e67f04ead2d0f0dba4c65e8 (patch)
treed90f4d12d62e59561a319b26f19ec12a75c082cd /net/wireless
parent34acac497b82d8ce449ee6d94abe7e36766d0f10 (diff)
cfg80211: fix a type issue in ieee80211_chandef_to_operating_class()
[ Upstream commit 8442938c3a2177ba16043b3a935f2c78266ad399 ] The "chandef->center_freq1" variable is a u32 but "freq" is a u16 so we are truncating away the high bits. I noticed this bug because in commit 9cf0a0b4b64a ("cfg80211: Add support for 60GHz band channels 5 and 6") we made "freq <= 56160 + 2160 * 6" a valid requency when before it was only "freq <= 56160 + 2160 * 4" that was valid. It introduces a static checker warning: net/wireless/util.c:1571 ieee80211_chandef_to_operating_class() warn: always true condition '(freq <= 56160 + 2160 * 6) => (0-u16max <= 69120)' But really we probably shouldn't have been truncating the high bits away to begin with. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index bb54d9db82df..3b9a81998014 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1432,7 +1432,7 @@ bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
u8 *op_class)
{
u8 vht_opclass;
- u16 freq = chandef->center_freq1;
+ u32 freq = chandef->center_freq1;
if (freq >= 2412 && freq <= 2472) {
if (chandef->width > NL80211_CHAN_WIDTH_40)