On Thu, Sep 28, 2023 at 02:39:36PM +0200, Remi Pommarel wrote:
diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index 27597f4cdf3e..9b7d4de182d0 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -866,10 +866,12 @@ static u32 batadv_v_get_throughput(struct batadv_ogm2_packet *ogm,
[...]
- return min_t(u32, lth, oth);
- /* OGM throughput was divided by two for retrocompatibility sake */
- oth *= 2;
- return oth * lth / (oth + lth);
Also looks like we'd have potential integer overflow issues here as oth, lth and the return value are all u32.
In the worst case (oth + lth) could wrap around to 0 and we'd divide by zero?