]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.160/cfg80211-fix-a-type-issue-in-ieee80211_chandef_to_operating_class.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.160 / cfg80211-fix-a-type-issue-in-ieee80211_chandef_to_operating_class.patch
1 From foo@baz Thu Oct 4 12:39:38 PDT 2018
2 From: Dan Carpenter <dan.carpenter@oracle.com>
3 Date: Fri, 31 Aug 2018 11:10:55 +0300
4 Subject: cfg80211: fix a type issue in ieee80211_chandef_to_operating_class()
5
6 From: Dan Carpenter <dan.carpenter@oracle.com>
7
8 [ Upstream commit 8442938c3a2177ba16043b3a935f2c78266ad399 ]
9
10 The "chandef->center_freq1" variable is a u32 but "freq" is a u16 so we
11 are truncating away the high bits. I noticed this bug because in commit
12 9cf0a0b4b64a ("cfg80211: Add support for 60GHz band channels 5 and 6")
13 we made "freq <= 56160 + 2160 * 6" a valid requency when before it was
14 only "freq <= 56160 + 2160 * 4" that was valid. It introduces a static
15 checker warning:
16
17 net/wireless/util.c:1571 ieee80211_chandef_to_operating_class()
18 warn: always true condition '(freq <= 56160 + 2160 * 6) => (0-u16max <= 69120)'
19
20 But really we probably shouldn't have been truncating the high bits
21 away to begin with.
22
23 Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
24 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
25 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27 ---
28 net/wireless/util.c | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
30
31 --- a/net/wireless/util.c
32 +++ b/net/wireless/util.c
33 @@ -1360,7 +1360,7 @@ bool ieee80211_chandef_to_operating_clas
34 u8 *op_class)
35 {
36 u8 vht_opclass;
37 - u16 freq = chandef->center_freq1;
38 + u32 freq = chandef->center_freq1;
39
40 if (freq >= 2412 && freq <= 2472) {
41 if (chandef->width > NL80211_CHAN_WIDTH_40)