cfg80211: fix a type issue in ieee80211_chandef_to_operating_class()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 31 Aug 2018 08:10:55 +0000 (11:10 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 3 Sep 2018 08:34:12 +0000 (10:34 +0200)
commit8442938c3a2177ba16043b3a935f2c78266ad399
tree1b188162a38fd239ce6abe8ed57167452735965d
parent66eb02d839e8495ae6b612e2d09ff599374b80e2
cfg80211: fix a type issue in ieee80211_chandef_to_operating_class()

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>
net/wireless/util.c