diff options
author | Antonio Quartulli <ordex@autistici.org> | 2012-03-16 06:52:31 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-05-13 12:24:37 -0400 |
commit | 8710e2613a4819aac44f4aed7e29027ac3eeb683 (patch) | |
tree | 52a61a7ad228152e6c62111b6472b51bbecaf90c /net | |
parent | f96a8a0b78548c0ec06b0b4b438db6ee895d67e9 (diff) |
batman-adv: avoid skb_linearise() if not needed
Whenever we want to access headers only, we do not need to linearise the whole
packet. Instead we can use pskb_may_pull()
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/routing.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 7ed9d8f92916..4c6467db881c 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -916,8 +916,9 @@ static int check_unicast_ttvn(struct bat_priv *bat_priv, | |||
916 | 916 | ||
917 | /* Check whether I have to reroute the packet */ | 917 | /* Check whether I have to reroute the packet */ |
918 | if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) { | 918 | if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) { |
919 | /* Linearize the skb before accessing it */ | 919 | /* check if there is enough data before accessing it */ |
920 | if (skb_linearize(skb) < 0) | 920 | if (pskb_may_pull(skb, sizeof(struct unicast_packet) + |
921 | ETH_HLEN) < 0) | ||
921 | return 0; | 922 | return 0; |
922 | 923 | ||
923 | ethhdr = (struct ethhdr *)(skb->data + | 924 | ethhdr = (struct ethhdr *)(skb->data + |