aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2011-05-14 17:14:54 -0400
committerSven Eckelmann <sven@narfation.org>2011-05-30 01:39:33 -0400
commit704509b8d44886cebfbaff1a9813c35dfa986954 (patch)
tree7b353f1d4a33b31d55d2a85f8d70882ade1868ce /net/batman-adv/routing.c
parent958ca5985604a6f13387d32de489365df816558b (diff)
batman-adv: Calculate sizeof using variable insead of types
Documentation/CodingStyle recommends to use the form p = kmalloc(sizeof(*p), ...); to calculate the size of a struct and not the version where the struct name is spelled out to prevent bugs when the type of p changes. This also seems appropriate for manipulation of buffers when they are directly associated with p. Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/routing.c')
-rw-r--r--net/batman-adv/routing.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index e0df4a007eac..07f23ba31ad4 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1357,7 +1357,7 @@ out:
1357int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if) 1357int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
1358{ 1358{
1359 struct unicast_packet *unicast_packet; 1359 struct unicast_packet *unicast_packet;
1360 int hdr_size = sizeof(struct unicast_packet); 1360 int hdr_size = sizeof(*unicast_packet);
1361 1361
1362 if (check_unicast_packet(skb, hdr_size) < 0) 1362 if (check_unicast_packet(skb, hdr_size) < 0)
1363 return NET_RX_DROP; 1363 return NET_RX_DROP;
@@ -1377,7 +1377,7 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if)
1377{ 1377{
1378 struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); 1378 struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
1379 struct unicast_frag_packet *unicast_packet; 1379 struct unicast_frag_packet *unicast_packet;
1380 int hdr_size = sizeof(struct unicast_frag_packet); 1380 int hdr_size = sizeof(*unicast_packet);
1381 struct sk_buff *new_skb = NULL; 1381 struct sk_buff *new_skb = NULL;
1382 int ret; 1382 int ret;
1383 1383
@@ -1413,7 +1413,7 @@ int recv_bcast_packet(struct sk_buff *skb, struct hard_iface *recv_if)
1413 struct orig_node *orig_node = NULL; 1413 struct orig_node *orig_node = NULL;
1414 struct bcast_packet *bcast_packet; 1414 struct bcast_packet *bcast_packet;
1415 struct ethhdr *ethhdr; 1415 struct ethhdr *ethhdr;
1416 int hdr_size = sizeof(struct bcast_packet); 1416 int hdr_size = sizeof(*bcast_packet);
1417 int ret = NET_RX_DROP; 1417 int ret = NET_RX_DROP;
1418 int32_t seq_diff; 1418 int32_t seq_diff;
1419 1419
@@ -1491,7 +1491,7 @@ int recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if)
1491 struct vis_packet *vis_packet; 1491 struct vis_packet *vis_packet;
1492 struct ethhdr *ethhdr; 1492 struct ethhdr *ethhdr;
1493 struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface); 1493 struct bat_priv *bat_priv = netdev_priv(recv_if->soft_iface);
1494 int hdr_size = sizeof(struct vis_packet); 1494 int hdr_size = sizeof(*vis_packet);
1495 1495
1496 /* keep skb linear */ 1496 /* keep skb linear */
1497 if (skb_linearize(skb) < 0) 1497 if (skb_linearize(skb) < 0)