diff options
author | Jason Wang <jasowang@redhat.com> | 2011-09-18 19:48:31 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-09-20 14:37:22 -0400 |
commit | 653fc9155769f8af8ea73e7e9c99dcaa5bd62086 (patch) | |
tree | c8cc3ca0a574dc2a8fbd0825d709ab0e1ce5ec41 /drivers/net/macvtap.c | |
parent | 59da45c4fe612cb4312bdf8e4f85fc295c73d50b (diff) |
macvtap: fix the uninitialized var using in macvtap_alloc_skb()
Commit d1b08284 use new frag API but would leave f to be used
uninitialized, this patch fix it.
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvtap.c')
-rw-r--r-- | drivers/net/macvtap.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 7c3f84acfdfb..3da557830937 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -453,7 +453,6 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from, | |||
453 | int copy = skb_headlen(skb); | 453 | int copy = skb_headlen(skb); |
454 | int size, offset1 = 0; | 454 | int size, offset1 = 0; |
455 | int i = 0; | 455 | int i = 0; |
456 | skb_frag_t *f; | ||
457 | 456 | ||
458 | /* Skip over from offset */ | 457 | /* Skip over from offset */ |
459 | while (count && (offset >= from->iov_len)) { | 458 | while (count && (offset >= from->iov_len)) { |
@@ -503,14 +502,13 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from, | |||
503 | skb->truesize += len; | 502 | skb->truesize += len; |
504 | atomic_add(len, &skb->sk->sk_wmem_alloc); | 503 | atomic_add(len, &skb->sk->sk_wmem_alloc); |
505 | while (len) { | 504 | while (len) { |
506 | __skb_fill_page_desc( | 505 | int off = base & ~PAGE_MASK; |
507 | skb, i, page[i], | 506 | int size = min_t(int, len, PAGE_SIZE - off); |
508 | base & ~PAGE_MASK, | 507 | __skb_fill_page_desc(skb, i, page[i], off, size); |
509 | min_t(int, len, PAGE_SIZE - f->page_offset)); | ||
510 | skb_shinfo(skb)->nr_frags++; | 508 | skb_shinfo(skb)->nr_frags++; |
511 | /* increase sk_wmem_alloc */ | 509 | /* increase sk_wmem_alloc */ |
512 | base += f->size; | 510 | base += size; |
513 | len -= f->size; | 511 | len -= size; |
514 | i++; | 512 | i++; |
515 | } | 513 | } |
516 | offset1 = 0; | 514 | offset1 = 0; |