public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] skbuff: Use correct allocation in skb_copy_ubufs
@ 2012-07-17 12:05 Krishna Kumar
  2012-07-18 16:45 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Krishna Kumar @ 2012-07-17 12:05 UTC (permalink / raw)
  To: davem; +Cc: xma, netdev, Krishna Kumar

Use correct allocation flags during copy of user space fragments
to the kernel. Also "improve" couple of for loops.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
 skbuff.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff -ruNp org/net/core/skbuff.c new/net/core/skbuff.c
--- org/net/core/skbuff.c	2012-07-17 09:56:12.000000000 +0530
+++ new/net/core/skbuff.c	2012-07-17 11:05:43.715853844 +0530
@@ -751,7 +751,7 @@ int skb_copy_ubufs(struct sk_buff *skb, 
 		u8 *vaddr;
 		skb_frag_t *f = &skb_shinfo(skb)->frags[i];
 
-		page = alloc_page(GFP_ATOMIC);
+		page = alloc_page(gfp_mask);
 		if (!page) {
 			while (head) {
 				struct page *next = (struct page *)head->private;
@@ -769,15 +769,15 @@ int skb_copy_ubufs(struct sk_buff *skb, 
 	}
 
 	/* skb frags release userspace buffers */
-	for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
+	for (i = 0; i < num_frags; i++)
 		skb_frag_unref(skb, i);
 
 	uarg->callback(uarg);
 
 	/* skb frags point to kernel buffers */
-	for (i = skb_shinfo(skb)->nr_frags; i > 0; i--) {
-		__skb_fill_page_desc(skb, i-1, head, 0,
-				     skb_shinfo(skb)->frags[i - 1].size);
+	for (i = num_frags - 1; i >= 0; i--) {
+		__skb_fill_page_desc(skb, i, head, 0,
+				     skb_shinfo(skb)->frags[i].size);
 		head = (struct page *)head->private;
 	}
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] skbuff: Use correct allocation in skb_copy_ubufs
  2012-07-17 12:05 [PATCH] skbuff: Use correct allocation in skb_copy_ubufs Krishna Kumar
@ 2012-07-18 16:45 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-07-18 16:45 UTC (permalink / raw)
  To: krkumar2; +Cc: xma, netdev

From: Krishna Kumar <krkumar2@in.ibm.com>
Date: Tue, 17 Jul 2012 17:35:29 +0530

> Use correct allocation flags during copy of user space fragments
> to the kernel. Also "improve" couple of for loops.
> 
> Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>

Applied to net-next

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-18 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17 12:05 [PATCH] skbuff: Use correct allocation in skb_copy_ubufs Krishna Kumar
2012-07-18 16:45 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox