[B.A.T.M.A.N.] [PATCH v2 4/4] batman-adv: Fix gw_bandwidth calculation on 32 bit systems

Marek Lindner mareklindner at neomailbox.ch
Fri Jul 10 10:04:07 CEST 2015


On Sunday, June 21, 2015 14:42:52 Sven Eckelmann wrote:
> 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 at narfation.org>
> ---
> v2:
>  * rebased on current master
> 
>  net/batman-adv/gateway_common.c | 49
> +++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+),
> 7 deletions(-)

Applied in revision ca6b86f.

Thanks,
Marek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.open-mesh.org/pipermail/b.a.t.m.a.n/attachments/20150710/ec599044/attachment.sig>


More information about the B.A.T.M.A.N mailing list