b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: Antonio Quartulli <a@unstable.cc>
Cc: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH v5 3/4] batman-adv: B.A.T.M.A.N. V - implement GW selection logic
Date: Mon, 27 Jun 2016 08:19:22 +0200	[thread overview]
Message-ID: <2649945.JKXkXjyaxK@sven-edge> (raw)
In-Reply-To: <20160627023613.GX10666@prodigo>

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

On Monday 27 June 2016 10:36:13 Antonio Quartulli wrote:
> 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 ?

No, it isn't casted to a larger type. Yes, C has some wild casting rules but I
would not be aware of an "help the programmer to avoid overflows" casting
rule.

We had no other idea how to fix it in the mentioned commit. But here we can do
it without casting to u64.

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-06-27  6:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-12  4:14 [B.A.T.M.A.N.] [PATCH v5 0/6] GW code: make it algorithm-agnostic and add B.A.T.M.A.N. V support Antonio Quartulli
2016-06-12  4:14 ` [B.A.T.M.A.N.] [PATCH v5 1/4] batman-adv: make the GW selection class algorithm specific Antonio Quartulli
2016-06-13 10:45   ` Sven Eckelmann
2016-06-13 16:02     ` Antonio Quartulli
2016-06-12  4:14 ` [B.A.T.M.A.N.] [PATCH v5 2/4] batman-adv: make GW election code protocol specific Antonio Quartulli
2016-06-13 11:45   ` Sven Eckelmann
2016-06-12  4:14 ` [B.A.T.M.A.N.] [PATCH v5 3/4] batman-adv: B.A.T.M.A.N. V - implement GW selection logic Antonio Quartulli
2016-06-13 11:12   ` Sven Eckelmann
2016-06-13 16:02     ` Antonio Quartulli
2016-06-27  2:41     ` Antonio Quartulli
2016-06-13 11:26   ` Sven Eckelmann
2016-06-27  2:36     ` Antonio Quartulli
2016-06-27  6:19       ` Sven Eckelmann [this message]
2016-06-27  6:19         ` Antonio Quartulli
2016-06-13 11:45   ` Sven Eckelmann
2016-06-12  4:14 ` [B.A.T.M.A.N.] [PATCH v5 4/4] batman-adv: disable sysfs knobs when GW-mode is not implemented Antonio Quartulli
2016-06-13 10:47   ` Sven Eckelmann

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=2649945.JKXkXjyaxK@sven-edge \
    --to=sven@narfation.org \
    --cc=a@unstable.cc \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /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;
as well as URLs for NNTP newsgroup(s).