diff options
author | 2015-06-21 19:40:09 +0200 | |
---|---|---|
committer | 2015-08-25 00:12:22 +0200 | |
commit | 0b8336f5fc26f263821534d7a9a3633748692207 (patch) | |
tree | 54e85d0494e92dc8ac92027b2c116ba1107b9fa8 /net/batman-adv/sysfs.c | |
parent | batman-adv: Return EINVAL on invalid gw_bandwidth change (diff) | |
download | linux-dev-0b8336f5fc26f263821534d7a9a3633748692207.tar.xz linux-dev-0b8336f5fc26f263821534d7a9a3633748692207.zip |
batman-adv: Fix gw_bandwidth calculation on 32 bit systems
The TVLV for the gw_bandwidth stores everything as u32. But the
gw_bandwidth reads the signed long which limits the maximum value to
(2 ** 31 - 1) on systems with 4 byte long. Also the input value is always
converted from either Mibit/s or Kibit/s to 100Kibit/s. This reduces the
values even further when the user sets it via the default unit Kibit/s. It
may even cause an integer overflow and end up with a value the user never
intended.
Instead read the values as u64, check for possible overflows, do the unit
adjustments and then reduce the size to u32.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
Diffstat (limited to 'net/batman-adv/sysfs.c')
0 files changed, 0 insertions, 0 deletions