aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2019-02-25 00:57:41 (GMT)
committerJouni Malinen <j@w1.fi>2019-02-25 17:48:49 (GMT)
commit2f7bc0681632e153dd69ed651f91941b4ed3ade3 (patch)
tree5945fab64165609cca885d076c3a0ff92e22b4bd /wpa_supplicant
parentf3e671591e6938e27aa15ba52f258617456a8fac (diff)
downloadhostap-2f7bc0681632e153dd69ed651f91941b4ed3ade3.zip
hostap-2f7bc0681632e153dd69ed651f91941b4ed3ade3.tar.gz
hostap-2f7bc0681632e153dd69ed651f91941b4ed3ade3.tar.bz2
UBSan: Avoid a warning on unsigned integer overflow
wpa_non_pref_chan_cmp() needs to use explicit typecasts to avoid UBSan warnings for unsigned integer overflows. mbo.c:298:26: runtime error: unsigned integer overflow: 1 - 2 cannot be represented in type 'unsigned int' Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/mbo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/wpa_supplicant/mbo.c b/wpa_supplicant/mbo.c
index bd5020a..d2f1451 100644
--- a/wpa_supplicant/mbo.c
+++ b/wpa_supplicant/mbo.c
@@ -293,10 +293,10 @@ static int wpa_non_pref_chan_cmp(const void *_a, const void *_b)
const struct wpa_mbo_non_pref_channel *a = _a, *b = _b;
if (a->oper_class != b->oper_class)
- return a->oper_class - b->oper_class;
+ return (int) a->oper_class - (int) b->oper_class;
if (a->reason != b->reason)
- return a->reason - b->reason;
- return a->preference - b->preference;
+ return (int) a->reason - (int) b->reason;
+ return (int) a->preference - (int) b->preference;
}