From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: count_real_packets() in batman-adv assumes char is signed
Date: Wed, 15 Jun 2011 09:41:36 +0200 [thread overview]
Message-ID: <1308123697-7893-2-git-send-email-sven@narfation.org> (raw)
In-Reply-To: <1308123697-7893-1-git-send-email-sven@narfation.org>
From: David Howells <dhowells@redhat.com>
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.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marek Lindner <lindner_marek@yahoo.de>
cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
cc: Sven Eckelmann <sven@narfation.org>
cc: b.a.t.m.a.n@lists.open-mesh.org
cc: netdev@vger.kernel.org
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
bitarray.c | 4 ++--
bitarray.h | 2 +-
routing.c | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/bitarray.c b/bitarray.c
index 700ee4f..3659a25 100644
--- a/bitarray.c
+++ b/bitarray.c
@@ -26,8 +26,8 @@
/* returns true if the corresponding bit in the given seq_bits indicates true
* and curr_seqno is within range of last_seqno */
-uint8_t get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
- uint32_t curr_seqno)
+int get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
+ uint32_t curr_seqno)
{
int32_t diff, word_offset, word_num;
diff --git a/bitarray.h b/bitarray.h
index e32eb2d..9fcdbdf 100644
--- a/bitarray.h
+++ b/bitarray.h
@@ -26,7 +26,7 @@
/* returns true if the corresponding bit in the given seq_bits indicates true
* and curr_seqno is within range of last_seqno */
-uint8_t get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
+int get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
uint32_t curr_seqno);
/* turn corresponding bit on, so we can remember that we got the packet */
diff --git a/routing.c b/routing.c
index 7ca4b42..2e037e3 100644
--- a/routing.c
+++ b/routing.c
@@ -381,7 +381,7 @@ static void update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
const struct ethhdr *ethhdr,
const struct batman_packet *batman_packet,
struct hard_iface *if_incoming,
- const unsigned char *tt_buff, char is_duplicate)
+ const unsigned char *tt_buff, int is_duplicate)
{
struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
struct neigh_node *router = NULL;
@@ -548,7 +548,7 @@ static int window_protected(struct bat_priv *bat_priv,
* -1 the packet is old and has been received while the seqno window
* was protected. Caller should drop it.
*/
-static char count_real_packets(const struct ethhdr *ethhdr,
+static int count_real_packets(const struct ethhdr *ethhdr,
const struct batman_packet *batman_packet,
const struct hard_iface *if_incoming)
{
@@ -556,7 +556,7 @@ static char count_real_packets(const struct ethhdr *ethhdr,
struct orig_node *orig_node;
struct neigh_node *tmp_neigh_node;
struct hlist_node *node;
- char is_duplicate = 0;
+ int is_duplicate = 0;
int32_t seq_diff;
int need_update = 0;
int set_mark, ret = -1;
@@ -625,7 +625,7 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
char has_directlink_flag;
char is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0;
char is_broadcast = 0, is_bidirectional, is_single_hop_neigh;
- char is_duplicate;
+ int is_duplicate;
uint32_t if_incoming_seqno;
/* Silently drop when the batman packet is actually not a
--
1.7.5.3
next prev parent reply other threads:[~2011-06-15 7:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-15 7:41 [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: Fix line over 80 characters Sven Eckelmann
2011-06-15 7:41 ` Sven Eckelmann [this message]
2011-06-15 19:04 ` [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: count_real_packets() in batman-adv assumes char is signed Marek Lindner
2011-06-15 7:41 ` [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: Reduce usage of char Sven Eckelmann
2011-06-15 20:27 ` Marek Lindner
2011-06-15 18:58 ` [B.A.T.M.A.N.] [PATCH 1/3] batman-adv: Fix line over 80 characters 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=1308123697-7893-2-git-send-email-sven@narfation.org \
--to=sven@narfation.org \
--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