batman-adv: use ETH_HLEN instead of sizeof(struct ethhdr)
Instead of using sizeof(struct ethhdr) it is strongly recommended to use the
kernel macro ETH_HLEN. This patch substitute each occurrence of the former
expressione with the latter one.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index c8642b5..ad394c6 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -290,9 +290,7 @@
goto out;
ethhdr = (struct ethhdr *)skb->data;
- hw_src = (uint8_t *)ethhdr +
- sizeof(struct ethhdr) +
- sizeof(struct arphdr);
+ hw_src = (uint8_t *)ethhdr + ETH_HLEN + sizeof(struct arphdr);
/* now we pretend that the client would have sent this ... */
switch (claimtype) {
@@ -340,7 +338,7 @@
skb_reset_mac_header(skb);
skb->protocol = eth_type_trans(skb, soft_iface);
bat_priv->stats.rx_packets++;
- bat_priv->stats.rx_bytes += skb->len + sizeof(struct ethhdr);
+ bat_priv->stats.rx_bytes += skb->len + ETH_HLEN;
soft_iface->last_rx = jiffies;
netif_rx(skb);
@@ -844,7 +842,7 @@
headlen = sizeof(*vhdr);
} else {
proto = ntohs(ethhdr->h_proto);
- headlen = sizeof(*ethhdr);
+ headlen = ETH_HLEN;
}
if (proto != ETH_P_ARP)
@@ -1302,7 +1300,7 @@
return 0;
/* first, find out the vid. */
- if (!pskb_may_pull(skb, hdr_size + sizeof(struct ethhdr)))
+ if (!pskb_may_pull(skb, hdr_size + ETH_HLEN))
return 0;
ethhdr = (struct ethhdr *)(((uint8_t *)skb->data) + hdr_size);