From: Antonio Quartulli <ordex@autistici.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Antonio Quartulli <ordex@autistici.org>
Subject: [PATCH 1/8] batman-adv: avoid skb_linearise() if not needed
Date: Mon, 14 May 2012 09:17:31 +0200 [thread overview]
Message-ID: <1336979858-13928-2-git-send-email-ordex@autistici.org> (raw)
In-Reply-To: <1336979858-13928-1-git-send-email-ordex@autistici.org>
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>
---
net/batman-adv/routing.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 7ed9d8f..4c6467d 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,
/* Check whether I have to reroute the packet */
if (seq_before(unicast_packet->ttvn, curr_ttvn) || tt_poss_change) {
- /* Linearize the skb before accessing it */
- if (skb_linearize(skb) < 0)
+ /* check if there is enough data before accessing it */
+ if (pskb_may_pull(skb, sizeof(struct unicast_packet) +
+ ETH_HLEN) < 0)
return 0;
ethhdr = (struct ethhdr *)(skb->data +
--
1.7.9.4
next prev parent reply other threads:[~2012-05-14 7:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-14 7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
2012-05-14 7:17 ` Antonio Quartulli [this message]
2012-05-14 7:17 ` [PATCH 2/8] batman-adv: improve unicast packet (re)routing Antonio Quartulli
2012-05-14 7:17 ` [PATCH 3/8] batman-adv: prepare lq_update_lock to be shared among different protocols Antonio Quartulli
2012-05-14 7:17 ` [PATCH 4/8] batman-adv: refactor window_protected to avoid unnecessary return statement Antonio Quartulli
2012-05-14 7:17 ` [PATCH 5/8] batman-adv: use shorter pr_warn instead of pr_warning Antonio Quartulli
2012-05-14 7:17 ` [PATCH 6/8] batman-adv: Start new development cycle Antonio Quartulli
2012-05-14 7:17 ` [PATCH 7/8] batman-adv: README cleanups Antonio Quartulli
2012-05-14 7:17 ` [PATCH 8/8] batman-adv: unset the TT_CLIENT_PENDING flag if the new local entry already exists Antonio Quartulli
[not found] ` <1336979858-13928-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
2012-05-14 22:17 ` pull request: batman-adv 2012-05-14 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1336979858-13928-2-git-send-email-ordex@autistici.org \
--to=ordex@autistici.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox