mac80211: update to version based on 4.19-rc4
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 389-cfg80211-fix-a-type-issue-in-ieee80211_chandef_to_op.patch
1 From: Dan Carpenter <dan.carpenter@oracle.com>
2 Date: Fri, 31 Aug 2018 11:10:55 +0300
3 Subject: [PATCH] cfg80211: fix a type issue in
4 ieee80211_chandef_to_operating_class()
5
6 The "chandef->center_freq1" variable is a u32 but "freq" is a u16 so we
7 are truncating away the high bits. I noticed this bug because in commit
8 9cf0a0b4b64a ("cfg80211: Add support for 60GHz band channels 5 and 6")
9 we made "freq <= 56160 + 2160 * 6" a valid requency when before it was
10 only "freq <= 56160 + 2160 * 4" that was valid. It introduces a static
11 checker warning:
12
13 net/wireless/util.c:1571 ieee80211_chandef_to_operating_class()
14 warn: always true condition '(freq <= 56160 + 2160 * 6) => (0-u16max <= 69120)'
15
16 But really we probably shouldn't have been truncating the high bits
17 away to begin with.
18
19 Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
20 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
21 ---
22
23 --- a/net/wireless/util.c
24 +++ b/net/wireless/util.c
25 @@ -1377,7 +1377,7 @@ bool ieee80211_chandef_to_operating_clas
26 u8 *op_class)
27 {
28 u8 vht_opclass;
29 - u16 freq = chandef->center_freq1;
30 + u32 freq = chandef->center_freq1;
31
32 if (freq >= 2412 && freq <= 2472) {
33 if (chandef->width > NL80211_CHAN_WIDTH_40)