From: marcelo.leitner@gmail.com
To: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Cc: netdev@vger.kernel.org, rds-devel@oss.oracle.com,
santosh.shilimkar@oracle.com, davem@davemloft.net,
eric.dumazet@gmail.com
Subject: Re: [PATCH net-next 1/2] skbuff: Add pskb_extract() helper function
Date: Fri, 22 Apr 2016 20:27:50 -0300 [thread overview]
Message-ID: <20160422232750.GB1594@localhost.localdomain> (raw)
In-Reply-To: <8d683318ede700f5f1b4d4333dfad8a1935f9ce6.1461086306.git.sowmini.varadhan@oracle.com>
On Wed, Apr 20, 2016 at 03:17:41AM -0700, Sowmini Varadhan wrote:
...
> +/* Extract to_copy bytes starting at off from skb, and return this in
> + * a new skb
> + */
> +struct sk_buff *pskb_extract(struct sk_buff *skb, int off,
> + int to_copy, gfp_t gfp)
> +{
> + struct sk_buff *clone = skb_clone(skb, gfp);
> +
> + if (!clone)
> + return NULL;
> +
> + if (pskb_carve(clone, off, gfp) < 0) {
> + pr_warn("pskb_carve failed\n");
You most likely don't want these pr_warn
> + kfree_skb(clone);
> + return NULL;
> + }
> +
> + if (pskb_trim(clone, to_copy)) {
> + pr_warn("pskb_trim failed\n");
> + kfree_skb(clone);
> + return NULL;
> + }
> + return clone;
Then these two blocks can be just:
if (pskb_carve(clone, off, gfp) < 0 ||
pskb_trim(clone, to_copy)) {
kfree_skb(clone);
clone = NULL;
}
return clone;
Marcelo
> +}
> +EXPORT_SYMBOL(pskb_extract);
> --
> 1.7.1
>
next prev parent reply other threads:[~2016-04-22 23:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-20 10:17 [PATCH net-next 0/2] pskb_extract() helper function Sowmini Varadhan
2016-04-20 10:17 ` [PATCH net-next 1/2] skbuff: Add " Sowmini Varadhan
2016-04-22 23:27 ` marcelo.leitner [this message]
2016-04-20 10:17 ` [PATCH net-next 2/2] RDS: TCP: Call " Sowmini Varadhan
2016-04-22 23:23 ` [PATCH net-next 0/2] " marcelo.leitner
2016-04-22 23:41 ` Sowmini Varadhan
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=20160422232750.GB1594@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rds-devel@oss.oracle.com \
--cc=santosh.shilimkar@oracle.com \
--cc=sowmini.varadhan@oracle.com \
/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;
as well as URLs for NNTP newsgroup(s).