aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/vis.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-06-03 16:19:07 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-28 02:44:53 -0400
commit347c80f0fb9adbd5f3756bd8a612664492768808 (patch)
treeeb5a95b473d056ed281eb9291861342e0c58efb6 /net/batman-adv/vis.c
parentd4f4469255359c97564b15b5ef04253fd3ec08f1 (diff)
batman-adv: Prefix local defines with BATADV_
Reported-by: Martin Hundebøll <martin@hundeboll.net> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/vis.c')
-rw-r--r--net/batman-adv/vis.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c
index 3095c41a67a..7dc750670c3 100644
--- a/net/batman-adv/vis.c
+++ b/net/batman-adv/vis.c
@@ -26,7 +26,7 @@
26#include "hash.h" 26#include "hash.h"
27#include "originator.h" 27#include "originator.h"
28 28
29#define MAX_VIS_PACKET_SIZE 1000 29#define BATADV_MAX_VIS_PACKET_SIZE 1000
30 30
31static void batadv_start_vis_timer(struct bat_priv *bat_priv); 31static void batadv_start_vis_timer(struct bat_priv *bat_priv);
32 32
@@ -544,10 +544,12 @@ static int batadv_find_best_vis_server(struct bat_priv *bat_priv,
544static bool batadv_vis_packet_full(const struct vis_info *info) 544static bool batadv_vis_packet_full(const struct vis_info *info)
545{ 545{
546 const struct vis_packet *packet; 546 const struct vis_packet *packet;
547 size_t num_items;
548
547 packet = (struct vis_packet *)info->skb_packet->data; 549 packet = (struct vis_packet *)info->skb_packet->data;
550 num_items = BATADV_MAX_VIS_PACKET_SIZE / sizeof(struct vis_info_entry);
548 551
549 if (MAX_VIS_PACKET_SIZE / sizeof(struct vis_info_entry) 552 if (num_items < packet->entries + 1)
550 < packet->entries + 1)
551 return true; 553 return true;
552 return false; 554 return false;
553} 555}
@@ -838,6 +840,7 @@ int batadv_vis_init(struct bat_priv *bat_priv)
838{ 840{
839 struct vis_packet *packet; 841 struct vis_packet *packet;
840 int hash_added; 842 int hash_added;
843 unsigned int len;
841 844
842 if (bat_priv->vis_hash) 845 if (bat_priv->vis_hash)
843 return 0; 846 return 0;
@@ -850,13 +853,12 @@ int batadv_vis_init(struct bat_priv *bat_priv)
850 goto err; 853 goto err;
851 } 854 }
852 855
853 bat_priv->my_vis_info = kmalloc(MAX_VIS_PACKET_SIZE, GFP_ATOMIC); 856 bat_priv->my_vis_info = kmalloc(BATADV_MAX_VIS_PACKET_SIZE, GFP_ATOMIC);
854 if (!bat_priv->my_vis_info) 857 if (!bat_priv->my_vis_info)
855 goto err; 858 goto err;
856 859
857 bat_priv->my_vis_info->skb_packet = dev_alloc_skb(sizeof(*packet) + 860 len = sizeof(*packet) + BATADV_MAX_VIS_PACKET_SIZE + ETH_HLEN;
858 MAX_VIS_PACKET_SIZE + 861 bat_priv->my_vis_info->skb_packet = dev_alloc_skb(len);
859 ETH_HLEN);
860 if (!bat_priv->my_vis_info->skb_packet) 862 if (!bat_priv->my_vis_info->skb_packet)
861 goto free_info; 863 goto free_info;
862 864