B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: Remi Pommarel <repk@triplefau.lt>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [PATCH RFC 2/2] batman-adv: Better half duplex penalty estimation
Date: Sat, 14 Oct 2023 08:24:22 +0200	[thread overview]
Message-ID: <ZSo0FgLjKTOmB_Gx@sellars> (raw)
In-Reply-To: <09c086e5e68055e52d1f92ba17d0e921084107e7.1695904299.git.repk@triplefau.lt>

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?

  parent reply	other threads:[~2023-10-14  6:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 12:39 [PATCH RFC 0/2] Better throughput estimation on half duplex interfaces Remi Pommarel
2023-09-28 12:39 ` [PATCH RFC 1/2] batman-adv: Keep half duplex penalty on OGM receiving side also Remi Pommarel
2023-09-28 12:39 ` [PATCH RFC 2/2] batman-adv: Better half duplex penalty estimation Remi Pommarel
2023-10-14  5:10   ` Linus Lüssing
2023-10-14  6:03     ` Linus Lüssing
2023-10-18 19:58     ` Remi Pommarel
2023-10-18 21:37       ` Nicolas Escande
2023-10-14  6:24   ` Linus Lüssing [this message]
2023-09-28 15:33 ` [PATCH RFC 0/2] Better throughput estimation on half duplex interfaces Marek Lindner
2023-09-28 16:48   ` Remi Pommarel
2023-09-28 17:54     ` Remi Pommarel
2023-09-28 18:10     ` Marek Lindner
2023-09-28 19:16       ` Remi Pommarel
2023-10-03 21:06         ` Marek Lindner
2023-10-11  8:55           ` Remi Pommarel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZSo0FgLjKTOmB_Gx@sellars \
    --to=linus.luessing@c0d3.blue \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=repk@triplefau.lt \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox