From: Marek Lindner <mareklindner@neomailbox.ch>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH v2 4/4] batman-adv: Fix gw_bandwidth calculation on 32 bit systems
Date: Fri, 10 Jul 2015 16:04:07 +0800 [thread overview]
Message-ID: <1606313.sbytlt8Win@voltaire> (raw)
In-Reply-To: <1434890572-3199-4-git-send-email-sven@narfation.org>
[-- Attachment #1: Type: text/plain, Size: 917 bytes --]
On Sunday, June 21, 2015 14:42:52 Sven Eckelmann wrote:
> The TVLV for the gw_bandwidth stores everything as u32. But the
> gw_bandwidth reads the signed long which limits the maximum value to
> (2 ** 31 - 1) on systems with 4 byte long. Also the input value is always
> converted from either Mibit/s or Kibit/s to 100Kibit/s. This reduces the
> values even further when the user sets it via the default unit Kibit/s. It
> may even cause an integer overflow and end up with a value the user never
> intended.
>
> Instead read the values as u64, check for possible overflows, do the unit
> adjustments and then reduce the size to u32.
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
> v2:
> * rebased on current master
>
> net/batman-adv/gateway_common.c | 49
> +++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+),
> 7 deletions(-)
Applied in revision ca6b86f.
Thanks,
Marek
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-07-10 8:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-21 12:42 [B.A.T.M.A.N.] [PATCH v2 1/4] batman-adv: Return EINVAL on invalid gw_bandwidth change Sven Eckelmann
2015-06-21 12:42 ` [B.A.T.M.A.N.] [PATCH v2 2/4] batman-adv: Backport kstrtou64 for Linux < 2.6.39 Sven Eckelmann
2015-07-10 8:01 ` Marek Lindner
2015-06-21 12:42 ` [B.A.T.M.A.N.] [PATCH v2 3/4] batman-adv: Define (u|s)(8|16|32|64) limits for Linux < 3.14 Sven Eckelmann
2015-07-10 8:02 ` Marek Lindner
2015-06-21 12:42 ` [B.A.T.M.A.N.] [PATCH v2 4/4] batman-adv: Fix gw_bandwidth calculation on 32 bit systems Sven Eckelmann
2015-06-29 9:47 ` Antonio Quartulli
2015-06-29 16:16 ` Sven Eckelmann
2015-06-29 16:36 ` Antonio Quartulli
2015-07-10 8:04 ` Marek Lindner [this message]
2015-06-28 14:40 ` [B.A.T.M.A.N.] [PATCH v2 1/4] batman-adv: Return EINVAL on invalid gw_bandwidth change Marek Lindner
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=1606313.sbytlt8Win@voltaire \
--to=mareklindner@neomailbox.ch \
--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