Skip to content

Commit b2c44a5

Browse files
dhowellsecsv
authored andcommitted
batman-adv: count_real_packets() in batman-adv assumes char is signed
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> [sven@narfation.org: Rebase on top of current version] Signed-off-by: Sven Eckelmann <sven@narfation.org>
1 parent db69ecf commit b2c44a5

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎net/batman-adv/bitarray.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
/* returns true if the corresponding bit in the given seq_bits indicates true
2828
* and curr_seqno is within range of last_seqno */
29-
uint8_t get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
30-
uint32_t curr_seqno)
29+
int get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
30+
uint32_t curr_seqno)
3131
{
3232
int32_t diff, word_offset, word_num;
3333

‎net/batman-adv/bitarray.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
/* returns true if the corresponding bit in the given seq_bits indicates true
2828
* and curr_seqno is within range of last_seqno */
29-
uint8_t get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
30-
uint32_t curr_seqno);
29+
int get_bit_status(const unsigned long *seq_bits, uint32_t last_seqno,
30+
uint32_t curr_seqno);
3131

3232
/* turn corresponding bit on, so we can remember that we got the packet */
3333
void bit_mark(unsigned long *seq_bits, int32_t n);

‎net/batman-adv/routing.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static void update_orig(struct bat_priv *bat_priv, struct orig_node *orig_node,
361361
const struct batman_packet *batman_packet,
362362
struct hard_iface *if_incoming,
363363
const unsigned char *tt_buff, int tt_buff_len,
364-
char is_duplicate)
364+
int is_duplicate)
365365
{
366366
struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
367367
struct neigh_node *router = NULL;
@@ -528,15 +528,15 @@ static int window_protected(struct bat_priv *bat_priv,
528528
* -1 the packet is old and has been received while the seqno window
529529
* was protected. Caller should drop it.
530530
*/
531-
static char count_real_packets(const struct ethhdr *ethhdr,
531+
static int count_real_packets(const struct ethhdr *ethhdr,
532532
const struct batman_packet *batman_packet,
533533
const struct hard_iface *if_incoming)
534534
{
535535
struct bat_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
536536
struct orig_node *orig_node;
537537
struct neigh_node *tmp_neigh_node;
538538
struct hlist_node *node;
539-
char is_duplicate = 0;
539+
int is_duplicate = 0;
540540
int32_t seq_diff;
541541
int need_update = 0;
542542
int set_mark, ret = -1;
@@ -605,7 +605,7 @@ void receive_bat_packet(const struct ethhdr *ethhdr,
605605
char has_directlink_flag;
606606
char is_my_addr = 0, is_my_orig = 0, is_my_oldorig = 0;
607607
char is_broadcast = 0, is_bidirectional, is_single_hop_neigh;
608-
char is_duplicate;
608+
int is_duplicate;
609609
uint32_t if_incoming_seqno;
610610

611611
/* Silently drop when the batman packet is actually not a

0 commit comments

Comments
 (0)