diff options
-rw-r--r-- | net/batman-adv/aggregation.c | 2 | ||||
-rw-r--r-- | net/batman-adv/bat_debugfs.c | 2 | ||||
-rw-r--r-- | net/batman-adv/gateway_client.c | 12 | ||||
-rw-r--r-- | net/batman-adv/hard-interface.c | 2 | ||||
-rw-r--r-- | net/batman-adv/hash.c | 7 | ||||
-rw-r--r-- | net/batman-adv/icmp_socket.c | 4 | ||||
-rw-r--r-- | net/batman-adv/originator.c | 4 | ||||
-rw-r--r-- | net/batman-adv/routing.c | 8 | ||||
-rw-r--r-- | net/batman-adv/send.c | 17 | ||||
-rw-r--r-- | net/batman-adv/soft-interface.c | 12 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 7 | ||||
-rw-r--r-- | net/batman-adv/unicast.c | 21 | ||||
-rw-r--r-- | net/batman-adv/unicast.h | 2 | ||||
-rw-r--r-- | net/batman-adv/vis.c | 37 |
14 files changed, 65 insertions, 72 deletions
diff --git a/net/batman-adv/aggregation.c b/net/batman-adv/aggregation.c index f8ccb49bf87e..b41f25b59470 100644 --- a/net/batman-adv/aggregation.c +++ b/net/batman-adv/aggregation.c | |||
@@ -119,7 +119,7 @@ static void new_aggregated_packet(const unsigned char *packet_buff, | |||
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | forw_packet_aggr = kmalloc(sizeof(struct forw_packet), GFP_ATOMIC); | 122 | forw_packet_aggr = kmalloc(sizeof(*forw_packet_aggr), GFP_ATOMIC); |
123 | if (!forw_packet_aggr) { | 123 | if (!forw_packet_aggr) { |
124 | if (!own_packet) | 124 | if (!own_packet) |
125 | atomic_inc(&bat_priv->batman_queue_left); | 125 | atomic_inc(&bat_priv->batman_queue_left); |
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c index 1049ae3f5367..d0af9bf69e46 100644 --- a/net/batman-adv/bat_debugfs.c +++ b/net/batman-adv/bat_debugfs.c | |||
@@ -185,7 +185,7 @@ static int debug_log_setup(struct bat_priv *bat_priv) | |||
185 | if (!bat_priv->debug_dir) | 185 | if (!bat_priv->debug_dir) |
186 | goto err; | 186 | goto err; |
187 | 187 | ||
188 | bat_priv->debug_log = kzalloc(sizeof(struct debug_log), GFP_ATOMIC); | 188 | bat_priv->debug_log = kzalloc(sizeof(*bat_priv->debug_log), GFP_ATOMIC); |
189 | if (!bat_priv->debug_log) | 189 | if (!bat_priv->debug_log) |
190 | goto err; | 190 | goto err; |
191 | 191 | ||
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index e9c7eb1a1f9d..a44dff3efb7f 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
@@ -273,7 +273,7 @@ static void gw_node_add(struct bat_priv *bat_priv, | |||
273 | struct gw_node *gw_node; | 273 | struct gw_node *gw_node; |
274 | int down, up; | 274 | int down, up; |
275 | 275 | ||
276 | gw_node = kzalloc(sizeof(struct gw_node), GFP_ATOMIC); | 276 | gw_node = kzalloc(sizeof(*gw_node), GFP_ATOMIC); |
277 | if (!gw_node) | 277 | if (!gw_node) |
278 | return; | 278 | return; |
279 | 279 | ||
@@ -508,7 +508,7 @@ int gw_is_target(struct bat_priv *bat_priv, struct sk_buff *skb) | |||
508 | /* check for ip header */ | 508 | /* check for ip header */ |
509 | switch (ntohs(ethhdr->h_proto)) { | 509 | switch (ntohs(ethhdr->h_proto)) { |
510 | case ETH_P_IP: | 510 | case ETH_P_IP: |
511 | if (!pskb_may_pull(skb, header_len + sizeof(struct iphdr))) | 511 | if (!pskb_may_pull(skb, header_len + sizeof(*iphdr))) |
512 | return 0; | 512 | return 0; |
513 | iphdr = (struct iphdr *)(skb->data + header_len); | 513 | iphdr = (struct iphdr *)(skb->data + header_len); |
514 | header_len += iphdr->ihl * 4; | 514 | header_len += iphdr->ihl * 4; |
@@ -519,10 +519,10 @@ int gw_is_target(struct bat_priv *bat_priv, struct sk_buff *skb) | |||
519 | 519 | ||
520 | break; | 520 | break; |
521 | case ETH_P_IPV6: | 521 | case ETH_P_IPV6: |
522 | if (!pskb_may_pull(skb, header_len + sizeof(struct ipv6hdr))) | 522 | if (!pskb_may_pull(skb, header_len + sizeof(*ipv6hdr))) |
523 | return 0; | 523 | return 0; |
524 | ipv6hdr = (struct ipv6hdr *)(skb->data + header_len); | 524 | ipv6hdr = (struct ipv6hdr *)(skb->data + header_len); |
525 | header_len += sizeof(struct ipv6hdr); | 525 | header_len += sizeof(*ipv6hdr); |
526 | 526 | ||
527 | /* check for udp header */ | 527 | /* check for udp header */ |
528 | if (ipv6hdr->nexthdr != IPPROTO_UDP) | 528 | if (ipv6hdr->nexthdr != IPPROTO_UDP) |
@@ -533,10 +533,10 @@ int gw_is_target(struct bat_priv *bat_priv, struct sk_buff *skb) | |||
533 | return 0; | 533 | return 0; |
534 | } | 534 | } |
535 | 535 | ||
536 | if (!pskb_may_pull(skb, header_len + sizeof(struct udphdr))) | 536 | if (!pskb_may_pull(skb, header_len + sizeof(*udphdr))) |
537 | return 0; | 537 | return 0; |
538 | udphdr = (struct udphdr *)(skb->data + header_len); | 538 | udphdr = (struct udphdr *)(skb->data + header_len); |
539 | header_len += sizeof(struct udphdr); | 539 | header_len += sizeof(*udphdr); |
540 | 540 | ||
541 | /* check for bootp port */ | 541 | /* check for bootp port */ |
542 | if ((ntohs(ethhdr->h_proto) == ETH_P_IP) && | 542 | if ((ntohs(ethhdr->h_proto) == ETH_P_IP) && |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index e626e75a7e65..e0052cf389db 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -459,7 +459,7 @@ static struct hard_iface *hardif_add_interface(struct net_device *net_dev) | |||
459 | 459 | ||
460 | dev_hold(net_dev); | 460 | dev_hold(net_dev); |
461 | 461 | ||
462 | hard_iface = kmalloc(sizeof(struct hard_iface), GFP_ATOMIC); | 462 | hard_iface = kmalloc(sizeof(*hard_iface), GFP_ATOMIC); |
463 | if (!hard_iface) { | 463 | if (!hard_iface) { |
464 | pr_err("Can't add interface (%s): out of memory\n", | 464 | pr_err("Can't add interface (%s): out of memory\n", |
465 | net_dev->name); | 465 | net_dev->name); |
diff --git a/net/batman-adv/hash.c b/net/batman-adv/hash.c index c5213d8f2cca..2a172505f513 100644 --- a/net/batman-adv/hash.c +++ b/net/batman-adv/hash.c | |||
@@ -46,15 +46,16 @@ struct hashtable_t *hash_new(int size) | |||
46 | { | 46 | { |
47 | struct hashtable_t *hash; | 47 | struct hashtable_t *hash; |
48 | 48 | ||
49 | hash = kmalloc(sizeof(struct hashtable_t), GFP_ATOMIC); | 49 | hash = kmalloc(sizeof(*hash), GFP_ATOMIC); |
50 | if (!hash) | 50 | if (!hash) |
51 | return NULL; | 51 | return NULL; |
52 | 52 | ||
53 | hash->table = kmalloc(sizeof(struct element_t *) * size, GFP_ATOMIC); | 53 | hash->table = kmalloc(sizeof(*hash->table) * size, GFP_ATOMIC); |
54 | if (!hash->table) | 54 | if (!hash->table) |
55 | goto free_hash; | 55 | goto free_hash; |
56 | 56 | ||
57 | hash->list_locks = kmalloc(sizeof(spinlock_t) * size, GFP_ATOMIC); | 57 | hash->list_locks = kmalloc(sizeof(*hash->list_locks) * size, |
58 | GFP_ATOMIC); | ||
58 | if (!hash->list_locks) | 59 | if (!hash->list_locks) |
59 | goto free_table; | 60 | goto free_table; |
60 | 61 | ||
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index fa22ba2bb832..ac3520e057c0 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -46,7 +46,7 @@ static int bat_socket_open(struct inode *inode, struct file *file) | |||
46 | 46 | ||
47 | nonseekable_open(inode, file); | 47 | nonseekable_open(inode, file); |
48 | 48 | ||
49 | socket_client = kmalloc(sizeof(struct socket_client), GFP_KERNEL); | 49 | socket_client = kmalloc(sizeof(*socket_client), GFP_KERNEL); |
50 | 50 | ||
51 | if (!socket_client) | 51 | if (!socket_client) |
52 | return -ENOMEM; | 52 | return -ENOMEM; |
@@ -310,7 +310,7 @@ static void bat_socket_add_packet(struct socket_client *socket_client, | |||
310 | { | 310 | { |
311 | struct socket_packet *socket_packet; | 311 | struct socket_packet *socket_packet; |
312 | 312 | ||
313 | socket_packet = kmalloc(sizeof(struct socket_packet), GFP_ATOMIC); | 313 | socket_packet = kmalloc(sizeof(*socket_packet), GFP_ATOMIC); |
314 | 314 | ||
315 | if (!socket_packet) | 315 | if (!socket_packet) |
316 | return; | 316 | return; |
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 3ea997deb112..a6c35d4e332b 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c | |||
@@ -86,7 +86,7 @@ struct neigh_node *create_neighbor(struct orig_node *orig_node, | |||
86 | bat_dbg(DBG_BATMAN, bat_priv, | 86 | bat_dbg(DBG_BATMAN, bat_priv, |
87 | "Creating new last-hop neighbor of originator\n"); | 87 | "Creating new last-hop neighbor of originator\n"); |
88 | 88 | ||
89 | neigh_node = kzalloc(sizeof(struct neigh_node), GFP_ATOMIC); | 89 | neigh_node = kzalloc(sizeof(*neigh_node), GFP_ATOMIC); |
90 | if (!neigh_node) | 90 | if (!neigh_node) |
91 | return NULL; | 91 | return NULL; |
92 | 92 | ||
@@ -196,7 +196,7 @@ struct orig_node *get_orig_node(struct bat_priv *bat_priv, const uint8_t *addr) | |||
196 | bat_dbg(DBG_BATMAN, bat_priv, | 196 | bat_dbg(DBG_BATMAN, bat_priv, |
197 | "Creating new originator: %pM\n", addr); | 197 | "Creating new originator: %pM\n", addr); |
198 | 198 | ||
199 | orig_node = kzalloc(sizeof(struct orig_node), GFP_ATOMIC); | 199 | orig_node = kzalloc(sizeof(*orig_node), GFP_ATOMIC); |
200 | if (!orig_node) | 200 | if (!orig_node) |
201 | return NULL; | 201 | return NULL; |
202 | 202 | ||
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: | |||
1357 | int recv_unicast_packet(struct sk_buff *skb, struct hard_iface *recv_if) | 1357 | int 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) |
diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 9a20ba9e056f..d0cfa95e3037 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c | |||
@@ -73,7 +73,7 @@ int send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface, | |||
73 | } | 73 | } |
74 | 74 | ||
75 | /* push to the ethernet header. */ | 75 | /* push to the ethernet header. */ |
76 | if (my_skb_head_push(skb, sizeof(struct ethhdr)) < 0) | 76 | if (my_skb_head_push(skb, sizeof(*ethhdr)) < 0) |
77 | goto send_skb_err; | 77 | goto send_skb_err; |
78 | 78 | ||
79 | skb_reset_mac_header(skb); | 79 | skb_reset_mac_header(skb); |
@@ -144,7 +144,7 @@ static void send_packet_to_if(struct forw_packet *forw_packet, | |||
144 | hard_iface->net_dev->name, | 144 | hard_iface->net_dev->name, |
145 | hard_iface->net_dev->dev_addr); | 145 | hard_iface->net_dev->dev_addr); |
146 | 146 | ||
147 | buff_pos += sizeof(struct batman_packet) + | 147 | buff_pos += sizeof(*batman_packet) + |
148 | (batman_packet->num_tt * ETH_ALEN); | 148 | (batman_packet->num_tt * ETH_ALEN); |
149 | packet_num++; | 149 | packet_num++; |
150 | batman_packet = (struct batman_packet *) | 150 | batman_packet = (struct batman_packet *) |
@@ -220,19 +220,18 @@ static void rebuild_batman_packet(struct bat_priv *bat_priv, | |||
220 | unsigned char *new_buff; | 220 | unsigned char *new_buff; |
221 | struct batman_packet *batman_packet; | 221 | struct batman_packet *batman_packet; |
222 | 222 | ||
223 | new_len = sizeof(struct batman_packet) + | 223 | new_len = sizeof(*batman_packet) + (bat_priv->num_local_tt * ETH_ALEN); |
224 | (bat_priv->num_local_tt * ETH_ALEN); | ||
225 | new_buff = kmalloc(new_len, GFP_ATOMIC); | 224 | new_buff = kmalloc(new_len, GFP_ATOMIC); |
226 | 225 | ||
227 | /* keep old buffer if kmalloc should fail */ | 226 | /* keep old buffer if kmalloc should fail */ |
228 | if (new_buff) { | 227 | if (new_buff) { |
229 | memcpy(new_buff, hard_iface->packet_buff, | 228 | memcpy(new_buff, hard_iface->packet_buff, |
230 | sizeof(struct batman_packet)); | 229 | sizeof(*batman_packet)); |
231 | batman_packet = (struct batman_packet *)new_buff; | 230 | batman_packet = (struct batman_packet *)new_buff; |
232 | 231 | ||
233 | batman_packet->num_tt = tt_local_fill_buffer(bat_priv, | 232 | batman_packet->num_tt = tt_local_fill_buffer(bat_priv, |
234 | new_buff + sizeof(struct batman_packet), | 233 | new_buff + sizeof(*batman_packet), |
235 | new_len - sizeof(struct batman_packet)); | 234 | new_len - sizeof(*batman_packet)); |
236 | 235 | ||
237 | kfree(hard_iface->packet_buff); | 236 | kfree(hard_iface->packet_buff); |
238 | hard_iface->packet_buff = new_buff; | 237 | hard_iface->packet_buff = new_buff; |
@@ -368,7 +367,7 @@ void schedule_forward_packet(struct orig_node *orig_node, | |||
368 | send_time = forward_send_time(); | 367 | send_time = forward_send_time(); |
369 | add_bat_packet_to_list(bat_priv, | 368 | add_bat_packet_to_list(bat_priv, |
370 | (unsigned char *)batman_packet, | 369 | (unsigned char *)batman_packet, |
371 | sizeof(struct batman_packet) + tt_buff_len, | 370 | sizeof(*batman_packet) + tt_buff_len, |
372 | if_incoming, 0, send_time); | 371 | if_incoming, 0, send_time); |
373 | } | 372 | } |
374 | 373 | ||
@@ -424,7 +423,7 @@ int add_bcast_packet_to_list(struct bat_priv *bat_priv, | |||
424 | if (!primary_if) | 423 | if (!primary_if) |
425 | goto out_and_inc; | 424 | goto out_and_inc; |
426 | 425 | ||
427 | forw_packet = kmalloc(sizeof(struct forw_packet), GFP_ATOMIC); | 426 | forw_packet = kmalloc(sizeof(*forw_packet), GFP_ATOMIC); |
428 | 427 | ||
429 | if (!forw_packet) | 428 | if (!forw_packet) |
430 | goto out_and_inc; | 429 | goto out_and_inc; |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 1bec3a0f9721..cead606008a1 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
@@ -123,8 +123,7 @@ static struct softif_neigh_vid *softif_neigh_vid_get(struct bat_priv *bat_priv, | |||
123 | goto out; | 123 | goto out; |
124 | } | 124 | } |
125 | 125 | ||
126 | softif_neigh_vid = kzalloc(sizeof(struct softif_neigh_vid), | 126 | softif_neigh_vid = kzalloc(sizeof(*softif_neigh_vid), GFP_ATOMIC); |
127 | GFP_ATOMIC); | ||
128 | if (!softif_neigh_vid) | 127 | if (!softif_neigh_vid) |
129 | goto out; | 128 | goto out; |
130 | 129 | ||
@@ -170,7 +169,7 @@ static struct softif_neigh *softif_neigh_get(struct bat_priv *bat_priv, | |||
170 | goto unlock; | 169 | goto unlock; |
171 | } | 170 | } |
172 | 171 | ||
173 | softif_neigh = kzalloc(sizeof(struct softif_neigh), GFP_ATOMIC); | 172 | softif_neigh = kzalloc(sizeof(*softif_neigh), GFP_ATOMIC); |
174 | if (!softif_neigh) | 173 | if (!softif_neigh) |
175 | goto unlock; | 174 | goto unlock; |
176 | 175 | ||
@@ -611,7 +610,7 @@ int interface_tx(struct sk_buff *skb, struct net_device *soft_iface) | |||
611 | if (!primary_if) | 610 | if (!primary_if) |
612 | goto dropped; | 611 | goto dropped; |
613 | 612 | ||
614 | if (my_skb_head_push(skb, sizeof(struct bcast_packet)) < 0) | 613 | if (my_skb_head_push(skb, sizeof(*bcast_packet)) < 0) |
615 | goto dropped; | 614 | goto dropped; |
616 | 615 | ||
617 | bcast_packet = (struct bcast_packet *)skb->data; | 616 | bcast_packet = (struct bcast_packet *)skb->data; |
@@ -790,7 +789,7 @@ static void interface_setup(struct net_device *dev) | |||
790 | 789 | ||
791 | SET_ETHTOOL_OPS(dev, &bat_ethtool_ops); | 790 | SET_ETHTOOL_OPS(dev, &bat_ethtool_ops); |
792 | 791 | ||
793 | memset(priv, 0, sizeof(struct bat_priv)); | 792 | memset(priv, 0, sizeof(*priv)); |
794 | } | 793 | } |
795 | 794 | ||
796 | struct net_device *softif_create(const char *name) | 795 | struct net_device *softif_create(const char *name) |
@@ -799,8 +798,7 @@ struct net_device *softif_create(const char *name) | |||
799 | struct bat_priv *bat_priv; | 798 | struct bat_priv *bat_priv; |
800 | int ret; | 799 | int ret; |
801 | 800 | ||
802 | soft_iface = alloc_netdev(sizeof(struct bat_priv) , name, | 801 | soft_iface = alloc_netdev(sizeof(*bat_priv), name, interface_setup); |
803 | interface_setup); | ||
804 | 802 | ||
805 | if (!soft_iface) { | 803 | if (!soft_iface) { |
806 | pr_err("Unable to allocate the batman interface: %s\n", name); | 804 | pr_err("Unable to allocate the batman interface: %s\n", name); |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 802eacef05b8..561f76968d5e 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -164,7 +164,7 @@ void tt_local_add(struct net_device *soft_iface, const uint8_t *addr) | |||
164 | bat_dbg(DBG_ROUTES, bat_priv, | 164 | bat_dbg(DBG_ROUTES, bat_priv, |
165 | "Creating new local tt entry: %pM\n", addr); | 165 | "Creating new local tt entry: %pM\n", addr); |
166 | 166 | ||
167 | tt_local_entry = kmalloc(sizeof(struct tt_local_entry), GFP_ATOMIC); | 167 | tt_local_entry = kmalloc(sizeof(*tt_local_entry), GFP_ATOMIC); |
168 | if (!tt_local_entry) | 168 | if (!tt_local_entry) |
169 | return; | 169 | return; |
170 | 170 | ||
@@ -427,9 +427,8 @@ void tt_global_add_orig(struct bat_priv *bat_priv, | |||
427 | if (!tt_global_entry) { | 427 | if (!tt_global_entry) { |
428 | spin_unlock_bh(&bat_priv->tt_ghash_lock); | 428 | spin_unlock_bh(&bat_priv->tt_ghash_lock); |
429 | 429 | ||
430 | tt_global_entry = | 430 | tt_global_entry = kmalloc(sizeof(*tt_global_entry), |
431 | kmalloc(sizeof(struct tt_global_entry), | 431 | GFP_ATOMIC); |
432 | GFP_ATOMIC); | ||
433 | 432 | ||
434 | if (!tt_global_entry) | 433 | if (!tt_global_entry) |
435 | break; | 434 | break; |
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index 82717fd9661d..6eabf42f8822 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
@@ -39,8 +39,8 @@ static struct sk_buff *frag_merge_packet(struct list_head *head, | |||
39 | (struct unicast_frag_packet *)skb->data; | 39 | (struct unicast_frag_packet *)skb->data; |
40 | struct sk_buff *tmp_skb; | 40 | struct sk_buff *tmp_skb; |
41 | struct unicast_packet *unicast_packet; | 41 | struct unicast_packet *unicast_packet; |
42 | int hdr_len = sizeof(struct unicast_packet); | 42 | int hdr_len = sizeof(*unicast_packet); |
43 | int uni_diff = sizeof(struct unicast_frag_packet) - hdr_len; | 43 | int uni_diff = sizeof(*up) - hdr_len; |
44 | 44 | ||
45 | /* set skb to the first part and tmp_skb to the second part */ | 45 | /* set skb to the first part and tmp_skb to the second part */ |
46 | if (up->flags & UNI_FRAG_HEAD) { | 46 | if (up->flags & UNI_FRAG_HEAD) { |
@@ -53,7 +53,7 @@ static struct sk_buff *frag_merge_packet(struct list_head *head, | |||
53 | if (skb_linearize(skb) < 0 || skb_linearize(tmp_skb) < 0) | 53 | if (skb_linearize(skb) < 0 || skb_linearize(tmp_skb) < 0) |
54 | goto err; | 54 | goto err; |
55 | 55 | ||
56 | skb_pull(tmp_skb, sizeof(struct unicast_frag_packet)); | 56 | skb_pull(tmp_skb, sizeof(*up)); |
57 | if (pskb_expand_head(skb, 0, tmp_skb->len, GFP_ATOMIC) < 0) | 57 | if (pskb_expand_head(skb, 0, tmp_skb->len, GFP_ATOMIC) < 0) |
58 | goto err; | 58 | goto err; |
59 | 59 | ||
@@ -99,8 +99,7 @@ static int frag_create_buffer(struct list_head *head) | |||
99 | struct frag_packet_list_entry *tfp; | 99 | struct frag_packet_list_entry *tfp; |
100 | 100 | ||
101 | for (i = 0; i < FRAG_BUFFER_SIZE; i++) { | 101 | for (i = 0; i < FRAG_BUFFER_SIZE; i++) { |
102 | tfp = kmalloc(sizeof(struct frag_packet_list_entry), | 102 | tfp = kmalloc(sizeof(*tfp), GFP_ATOMIC); |
103 | GFP_ATOMIC); | ||
104 | if (!tfp) { | 103 | if (!tfp) { |
105 | frag_list_free(head); | 104 | frag_list_free(head); |
106 | return -ENOMEM; | 105 | return -ENOMEM; |
@@ -224,8 +223,8 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | |||
224 | struct hard_iface *primary_if; | 223 | struct hard_iface *primary_if; |
225 | struct sk_buff *frag_skb; | 224 | struct sk_buff *frag_skb; |
226 | struct unicast_frag_packet *frag1, *frag2; | 225 | struct unicast_frag_packet *frag1, *frag2; |
227 | int uc_hdr_len = sizeof(struct unicast_packet); | 226 | int uc_hdr_len = sizeof(*unicast_packet); |
228 | int ucf_hdr_len = sizeof(struct unicast_frag_packet); | 227 | int ucf_hdr_len = sizeof(*frag1); |
229 | int data_len = skb->len - uc_hdr_len; | 228 | int data_len = skb->len - uc_hdr_len; |
230 | int large_tail = 0, ret = NET_RX_DROP; | 229 | int large_tail = 0, ret = NET_RX_DROP; |
231 | uint16_t seqno; | 230 | uint16_t seqno; |
@@ -250,14 +249,14 @@ int frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, | |||
250 | frag1 = (struct unicast_frag_packet *)skb->data; | 249 | frag1 = (struct unicast_frag_packet *)skb->data; |
251 | frag2 = (struct unicast_frag_packet *)frag_skb->data; | 250 | frag2 = (struct unicast_frag_packet *)frag_skb->data; |
252 | 251 | ||
253 | memcpy(frag1, &tmp_uc, sizeof(struct unicast_packet)); | 252 | memcpy(frag1, &tmp_uc, sizeof(tmp_uc)); |
254 | 253 | ||
255 | frag1->ttl--; | 254 | frag1->ttl--; |
256 | frag1->version = COMPAT_VERSION; | 255 | frag1->version = COMPAT_VERSION; |
257 | frag1->packet_type = BAT_UNICAST_FRAG; | 256 | frag1->packet_type = BAT_UNICAST_FRAG; |
258 | 257 | ||
259 | memcpy(frag1->orig, primary_if->net_dev->dev_addr, ETH_ALEN); | 258 | memcpy(frag1->orig, primary_if->net_dev->dev_addr, ETH_ALEN); |
260 | memcpy(frag2, frag1, sizeof(struct unicast_frag_packet)); | 259 | memcpy(frag2, frag1, sizeof(*frag2)); |
261 | 260 | ||
262 | if (data_len & 1) | 261 | if (data_len & 1) |
263 | large_tail = UNI_FRAG_LARGETAIL; | 262 | large_tail = UNI_FRAG_LARGETAIL; |
@@ -314,7 +313,7 @@ find_router: | |||
314 | if (!neigh_node) | 313 | if (!neigh_node) |
315 | goto out; | 314 | goto out; |
316 | 315 | ||
317 | if (my_skb_head_push(skb, sizeof(struct unicast_packet)) < 0) | 316 | if (my_skb_head_push(skb, sizeof(*unicast_packet)) < 0) |
318 | goto out; | 317 | goto out; |
319 | 318 | ||
320 | unicast_packet = (struct unicast_packet *)skb->data; | 319 | unicast_packet = (struct unicast_packet *)skb->data; |
@@ -328,7 +327,7 @@ find_router: | |||
328 | memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); | 327 | memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); |
329 | 328 | ||
330 | if (atomic_read(&bat_priv->fragmentation) && | 329 | if (atomic_read(&bat_priv->fragmentation) && |
331 | data_len + sizeof(struct unicast_packet) > | 330 | data_len + sizeof(*unicast_packet) > |
332 | neigh_node->if_incoming->net_dev->mtu) { | 331 | neigh_node->if_incoming->net_dev->mtu) { |
333 | /* send frag skb decreases ttl */ | 332 | /* send frag skb decreases ttl */ |
334 | unicast_packet->ttl++; | 333 | unicast_packet->ttl++; |
diff --git a/net/batman-adv/unicast.h b/net/batman-adv/unicast.h index 2ba867cf4135..62f54b954625 100644 --- a/net/batman-adv/unicast.h +++ b/net/batman-adv/unicast.h | |||
@@ -49,7 +49,7 @@ static inline int frag_can_reassemble(const struct sk_buff *skb, int mtu) | |||
49 | uneven_correction = -1; | 49 | uneven_correction = -1; |
50 | } | 50 | } |
51 | 51 | ||
52 | merged_size = (skb->len - sizeof(struct unicast_frag_packet)) * 2; | 52 | merged_size = (skb->len - sizeof(*unicast_packet)) * 2; |
53 | merged_size += sizeof(struct unicast_packet) + uneven_correction; | 53 | merged_size += sizeof(struct unicast_packet) + uneven_correction; |
54 | 54 | ||
55 | return merged_size <= mtu; | 55 | return merged_size <= mtu; |
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index b48954cd1e12..ea8d7e91fcac 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -241,7 +241,7 @@ int vis_seq_print_text(struct seq_file *seq, void *offset) | |||
241 | hlist_for_each_entry_rcu(info, node, head, hash_entry) { | 241 | hlist_for_each_entry_rcu(info, node, head, hash_entry) { |
242 | packet = (struct vis_packet *)info->skb_packet->data; | 242 | packet = (struct vis_packet *)info->skb_packet->data; |
243 | entries = (struct vis_info_entry *) | 243 | entries = (struct vis_info_entry *) |
244 | ((char *)packet + sizeof(struct vis_packet)); | 244 | ((char *)packet + sizeof(*packet)); |
245 | 245 | ||
246 | for (j = 0; j < packet->entries; j++) { | 246 | for (j = 0; j < packet->entries; j++) { |
247 | if (entries[j].quality == 0) | 247 | if (entries[j].quality == 0) |
@@ -289,7 +289,7 @@ int vis_seq_print_text(struct seq_file *seq, void *offset) | |||
289 | hlist_for_each_entry_rcu(info, node, head, hash_entry) { | 289 | hlist_for_each_entry_rcu(info, node, head, hash_entry) { |
290 | packet = (struct vis_packet *)info->skb_packet->data; | 290 | packet = (struct vis_packet *)info->skb_packet->data; |
291 | entries = (struct vis_info_entry *) | 291 | entries = (struct vis_info_entry *) |
292 | ((char *)packet + sizeof(struct vis_packet)); | 292 | ((char *)packet + sizeof(*packet)); |
293 | 293 | ||
294 | for (j = 0; j < packet->entries; j++) { | 294 | for (j = 0; j < packet->entries; j++) { |
295 | if (entries[j].quality == 0) | 295 | if (entries[j].quality == 0) |
@@ -367,7 +367,7 @@ static void recv_list_add(struct bat_priv *bat_priv, | |||
367 | { | 367 | { |
368 | struct recvlist_node *entry; | 368 | struct recvlist_node *entry; |
369 | 369 | ||
370 | entry = kmalloc(sizeof(struct recvlist_node), GFP_ATOMIC); | 370 | entry = kmalloc(sizeof(*entry), GFP_ATOMIC); |
371 | if (!entry) | 371 | if (!entry) |
372 | return; | 372 | return; |
373 | 373 | ||
@@ -414,11 +414,11 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv, | |||
414 | return NULL; | 414 | return NULL; |
415 | 415 | ||
416 | /* see if the packet is already in vis_hash */ | 416 | /* see if the packet is already in vis_hash */ |
417 | search_elem.skb_packet = dev_alloc_skb(sizeof(struct vis_packet)); | 417 | search_elem.skb_packet = dev_alloc_skb(sizeof(*search_packet)); |
418 | if (!search_elem.skb_packet) | 418 | if (!search_elem.skb_packet) |
419 | return NULL; | 419 | return NULL; |
420 | search_packet = (struct vis_packet *)skb_put(search_elem.skb_packet, | 420 | search_packet = (struct vis_packet *)skb_put(search_elem.skb_packet, |
421 | sizeof(struct vis_packet)); | 421 | sizeof(*search_packet)); |
422 | 422 | ||
423 | memcpy(search_packet->vis_orig, vis_packet->vis_orig, ETH_ALEN); | 423 | memcpy(search_packet->vis_orig, vis_packet->vis_orig, ETH_ALEN); |
424 | old_info = vis_hash_find(bat_priv, &search_elem); | 424 | old_info = vis_hash_find(bat_priv, &search_elem); |
@@ -444,27 +444,26 @@ static struct vis_info *add_packet(struct bat_priv *bat_priv, | |||
444 | kref_put(&old_info->refcount, free_info); | 444 | kref_put(&old_info->refcount, free_info); |
445 | } | 445 | } |
446 | 446 | ||
447 | info = kmalloc(sizeof(struct vis_info), GFP_ATOMIC); | 447 | info = kmalloc(sizeof(*info), GFP_ATOMIC); |
448 | if (!info) | 448 | if (!info) |
449 | return NULL; | 449 | return NULL; |
450 | 450 | ||
451 | info->skb_packet = dev_alloc_skb(sizeof(struct vis_packet) + | 451 | info->skb_packet = dev_alloc_skb(sizeof(*packet) + vis_info_len + |
452 | vis_info_len + sizeof(struct ethhdr)); | 452 | sizeof(struct ethhdr)); |
453 | if (!info->skb_packet) { | 453 | if (!info->skb_packet) { |
454 | kfree(info); | 454 | kfree(info); |
455 | return NULL; | 455 | return NULL; |
456 | } | 456 | } |
457 | skb_reserve(info->skb_packet, sizeof(struct ethhdr)); | 457 | skb_reserve(info->skb_packet, sizeof(struct ethhdr)); |
458 | packet = (struct vis_packet *)skb_put(info->skb_packet, | 458 | packet = (struct vis_packet *)skb_put(info->skb_packet, sizeof(*packet) |
459 | sizeof(struct vis_packet) + | 459 | + vis_info_len); |
460 | vis_info_len); | ||
461 | 460 | ||
462 | kref_init(&info->refcount); | 461 | kref_init(&info->refcount); |
463 | INIT_LIST_HEAD(&info->send_list); | 462 | INIT_LIST_HEAD(&info->send_list); |
464 | INIT_LIST_HEAD(&info->recv_list); | 463 | INIT_LIST_HEAD(&info->recv_list); |
465 | info->first_seen = jiffies; | 464 | info->first_seen = jiffies; |
466 | info->bat_priv = bat_priv; | 465 | info->bat_priv = bat_priv; |
467 | memcpy(packet, vis_packet, sizeof(struct vis_packet) + vis_info_len); | 466 | memcpy(packet, vis_packet, sizeof(*packet) + vis_info_len); |
468 | 467 | ||
469 | /* initialize and add new packet. */ | 468 | /* initialize and add new packet. */ |
470 | *is_new = 1; | 469 | *is_new = 1; |
@@ -634,7 +633,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv) | |||
634 | packet->ttl = TTL; | 633 | packet->ttl = TTL; |
635 | packet->seqno = htonl(ntohl(packet->seqno) + 1); | 634 | packet->seqno = htonl(ntohl(packet->seqno) + 1); |
636 | packet->entries = 0; | 635 | packet->entries = 0; |
637 | skb_trim(info->skb_packet, sizeof(struct vis_packet)); | 636 | skb_trim(info->skb_packet, sizeof(*packet)); |
638 | 637 | ||
639 | if (packet->vis_type == VIS_TYPE_CLIENT_UPDATE) { | 638 | if (packet->vis_type == VIS_TYPE_CLIENT_UPDATE) { |
640 | best_tq = find_best_vis_server(bat_priv, info); | 639 | best_tq = find_best_vis_server(bat_priv, info); |
@@ -910,17 +909,15 @@ int vis_init(struct bat_priv *bat_priv) | |||
910 | goto err; | 909 | goto err; |
911 | } | 910 | } |
912 | 911 | ||
913 | bat_priv->my_vis_info->skb_packet = dev_alloc_skb( | 912 | bat_priv->my_vis_info->skb_packet = dev_alloc_skb(sizeof(*packet) + |
914 | sizeof(struct vis_packet) + | 913 | MAX_VIS_PACKET_SIZE + |
915 | MAX_VIS_PACKET_SIZE + | 914 | sizeof(struct ethhdr)); |
916 | sizeof(struct ethhdr)); | ||
917 | if (!bat_priv->my_vis_info->skb_packet) | 915 | if (!bat_priv->my_vis_info->skb_packet) |
918 | goto free_info; | 916 | goto free_info; |
919 | 917 | ||
920 | skb_reserve(bat_priv->my_vis_info->skb_packet, sizeof(struct ethhdr)); | 918 | skb_reserve(bat_priv->my_vis_info->skb_packet, sizeof(struct ethhdr)); |
921 | packet = (struct vis_packet *)skb_put( | 919 | packet = (struct vis_packet *)skb_put(bat_priv->my_vis_info->skb_packet, |
922 | bat_priv->my_vis_info->skb_packet, | 920 | sizeof(*packet)); |
923 | sizeof(struct vis_packet)); | ||
924 | 921 | ||
925 | /* prefill the vis info */ | 922 | /* prefill the vis info */ |
926 | bat_priv->my_vis_info->first_seen = jiffies - | 923 | bat_priv->my_vis_info->first_seen = jiffies - |