aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/originator.c
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2011-10-05 11:05:25 -0400
committerSven Eckelmann <sven@narfation.org>2011-11-20 07:08:33 -0500
commitc90681b8505946761b55d4981c9c3b56b3c4171b (patch)
treeb260388317b5dc1f4a8c00493eea6ff30fb47652 /net/batman-adv/originator.c
parenteb7e2a1e20488f91c7007caa080b83b8e4222572 (diff)
batman-adv: fixed hash functions type to uint32_t instead of int
There are two reasons for this fix: - the result of choose_orig() and vis_choose() is an index and therefore it can't be negative. Hence it is correct to make the return type unsigned too. - sizeof(int) may not be the same on ALL the architectures. Since we plan to use choose_orig() as DHT hash function, we need to guarantee that, given the same argument, the result is the same. Then it is correct to explicitly express the size of the return type (and the second argument). Since the expected length is currently 4, uint32_t is the most convenient choice. Signed-off-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/originator.c')
-rw-r--r--net/batman-adv/originator.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 0e5b77255d99..0bc2045a2f2e 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -164,7 +164,7 @@ void originator_free(struct bat_priv *bat_priv)
164 struct hlist_head *head; 164 struct hlist_head *head;
165 spinlock_t *list_lock; /* spinlock to protect write access */ 165 spinlock_t *list_lock; /* spinlock to protect write access */
166 struct orig_node *orig_node; 166 struct orig_node *orig_node;
167 int i; 167 uint32_t i;
168 168
169 if (!hash) 169 if (!hash)
170 return; 170 return;
@@ -350,7 +350,7 @@ static void _purge_orig(struct bat_priv *bat_priv)
350 struct hlist_head *head; 350 struct hlist_head *head;
351 spinlock_t *list_lock; /* spinlock to protect write access */ 351 spinlock_t *list_lock; /* spinlock to protect write access */
352 struct orig_node *orig_node; 352 struct orig_node *orig_node;
353 int i; 353 uint32_t i;
354 354
355 if (!hash) 355 if (!hash)
356 return; 356 return;
@@ -413,7 +413,8 @@ int orig_seq_print_text(struct seq_file *seq, void *offset)
413 int batman_count = 0; 413 int batman_count = 0;
414 int last_seen_secs; 414 int last_seen_secs;
415 int last_seen_msecs; 415 int last_seen_msecs;
416 int i, ret = 0; 416 uint32_t i;
417 int ret = 0;
417 418
418 primary_if = primary_if_get_selected(bat_priv); 419 primary_if = primary_if_get_selected(bat_priv);
419 420
@@ -519,7 +520,8 @@ int orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
519 struct hlist_node *node; 520 struct hlist_node *node;
520 struct hlist_head *head; 521 struct hlist_head *head;
521 struct orig_node *orig_node; 522 struct orig_node *orig_node;
522 int i, ret; 523 uint32_t i;
524 int ret;
523 525
524 /* resize all orig nodes because orig_node->bcast_own(_sum) depend on 526 /* resize all orig nodes because orig_node->bcast_own(_sum) depend on
525 * if_num */ 527 * if_num */
@@ -601,7 +603,8 @@ int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
601 struct hlist_head *head; 603 struct hlist_head *head;
602 struct hard_iface *hard_iface_tmp; 604 struct hard_iface *hard_iface_tmp;
603 struct orig_node *orig_node; 605 struct orig_node *orig_node;
604 int i, ret; 606 uint32_t i;
607 int ret;
605 608
606 /* resize all orig nodes because orig_node->bcast_own(_sum) depend on 609 /* resize all orig nodes because orig_node->bcast_own(_sum) depend on
607 * if_num */ 610 * if_num */