From: Antonio Quartulli <a@unstable.cc>
To: Sven Eckelmann <sven@narfation.org>
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 14:19:59 +0800 [thread overview]
Message-ID: <20160627061959.GB10666@prodigo> (raw)
In-Reply-To: <2649945.JKXkXjyaxK@sven-edge>
[-- Attachment #1: Type: text/plain, Size: 1440 bytes --]
On Mon, Jun 27, 2016 at 08:19:22AM +0200, Sven Eckelmann wrote:
> 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.
ok, thanks !
I will modify the patch in the next series.
Cheers,
--
Antonio Quartulli
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent 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
2016-06-27 6:19 ` Antonio Quartulli [this message]
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=20160627061959.GB10666@prodigo \
--to=a@unstable.cc \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=sven@narfation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.