On Mon, Jun 13, 2016 at 01:26:31PM +0200, Sven Eckelmann wrote:
On Sunday 12 June 2016 12:14:25 Antonio Quartulli wrote:
if (orig_throughput < (gw_throughput + threshold))
goto out;
Possible overflow problem in batadv_v_gw_is_eligible. We don't know what the user will add here and what the gw_throughput is.
We already had a similar problem in the BATMAN_IV gw selection code which resulted in weird gw selections. See f63c54bba31d ("batman-adv: Avoid u32 overflow during gateway select").
Sven, correct me if I am wrong, but in f63c54bba31d we are changing the type of the variables aimed to contain the value computed by the "overflowing" operation, while in this case we have everything in a if condition: should the temporary result be implicitly casted to a larger variable as required ?
I may be wrong - but I wanted to ask you to be sure.
Cheers,