From: Sven Eckelmann <sven@narfation.org>
To: David Howells <dhowells@redhat.com>
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Marek Lindner <lindner_marek@yahoo.de>,
Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Subject: Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: count_real_packets() in batman-adv assumes char is signed
Date: Wed, 15 Jun 2011 08:58:02 +0200 [thread overview]
Message-ID: <201106150858.04851.sven@narfation.org> (raw)
In-Reply-To: <20110614235132.3724.57632.stgit@warthog.procyon.org.uk>
[-- Attachment #1: Type: Text/Plain, Size: 1087 bytes --]
On Wednesday 15 June 2011 01:51:32 David Howells wrote:
> count_real_packets() in batman-adv assumes char is signed, and returns -1
> through it:
>
> net/batman-adv/routing.c: In function 'receive_bat_packet':
> net/batman-adv/routing.c:739: warning: comparison is always false due to
> limited range of data type
>
> Use int instead.
>
> This is also looks a bit weird as (presumably signed) is_duplicate is
> constructed by OR'ding together the unsigned results of get_bit_status()
> (though the latter only returns 0 or 1).
Sry, had to catch the train and had no time to explain it further.
It is correct that is_duplicate will only have 0 and 1 stored, but the
window_protected function (called before the loop) may detect that the packet
has to be dropped and we return in that case -1.
I don't know who started to use char in those places, but thanks for reminding
me how much I hate it and that I wanted to check the rest of the code. :)
I will submit the corrected patch in a pull request later this week to David
S. Miller.
Thanks,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2011-06-15 6:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 23:51 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: count_real_packets() in batman-adv assumes char is signed David Howells
2011-06-14 23:51 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: compare_eth() should take const pointer arguments David Howells
2011-06-15 5:56 ` Sven Eckelmann
2011-06-15 5:59 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: count_real_packets() in batman-adv assumes char is signed Sven Eckelmann
2011-06-15 6:58 ` Sven Eckelmann [this message]
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=201106150858.04851.sven@narfation.org \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=dhowells@redhat.com \
--cc=lindner_marek@yahoo.de \
--cc=netdev@vger.kernel.org \
--cc=siwu@hrz.tu-chemnitz.de \
/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