diff options
author | Sven Eckelmann <sven.eckelmann@open-mesh.com> | 2016-02-16 10:47:07 +0100 |
---|---|---|
committer | Antonio Quartulli <a@unstable.cc> | 2016-05-18 11:49:42 +0800 |
commit | d285f52cc0f23564fd61976d43fd5b991b4828f6 (patch) | |
tree | cb94178c532da21ddc3a53a82665bcaef9e1645a /net/batman-adv/originator.c | |
parent | 1653f61d656516aae7130db19561258a847d1e94 (diff) | |
download | op-kernel-dev-d285f52cc0f23564fd61976d43fd5b991b4828f6.zip op-kernel-dev-d285f52cc0f23564fd61976d43fd5b991b4828f6.tar.gz |
batman-adv: Fix integer overflow in batadv_iv_ogm_calc_tq
The undefined behavior sanatizer detected an signed integer overflow in a
setup with near perfect link quality
UBSAN: Undefined behaviour in net/batman-adv/bat_iv_ogm.c:1246:25
signed integer overflow:
8713350 * 255 cannot be represented in type 'int'
The problems happens because the calculation of mixed unsigned and signed
integers resulted in an integer multiplication.
batadv_ogm_packet::tq (u8 255)
* tq_own (u8 255)
* tq_asym_penalty (int 134; max 255)
* tq_iface_penalty (int 255; max 255)
The tq_iface_penalty, tq_asym_penalty and inv_asym_penalty can just be
changed to unsigned int because they are not expected to become negative.
Fixes: c039876892e3 ("batman-adv: add WiFi penalty")
Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Diffstat (limited to 'net/batman-adv/originator.c')
0 files changed, 0 insertions, 0 deletions