diff options
author | Jason Wang <jasowang@redhat.com> | 2011-09-19 03:48:31 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-09-20 22:37:22 +0400 |
commit | 653fc9155769f8af8ea73e7e9c99dcaa5bd62086 (patch) | |
tree | c8cc3ca0a574dc2a8fbd0825d709ab0e1ce5ec41 /drivers/net/macvtap.c | |
parent | 59da45c4fe612cb4312bdf8e4f85fc295c73d50b (diff) | |
download | linux-653fc9155769f8af8ea73e7e9c99dcaa5bd62086.tar.xz |
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, int copy = skb_headlen(skb); int size, offset1 = 0; int i = 0; - skb_frag_t *f; /* Skip over from offset */ while (count && (offset >= from->iov_len)) { @@ -503,14 +502,13 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from, skb->truesize += len; atomic_add(len, &skb->sk->sk_wmem_alloc); while (len) { - __skb_fill_page_desc( - skb, i, page[i], - base & ~PAGE_MASK, - min_t(int, len, PAGE_SIZE - f->page_offset)); + int off = base & ~PAGE_MASK; + int size = min_t(int, len, PAGE_SIZE - off); + __skb_fill_page_desc(skb, i, page[i], off, size); skb_shinfo(skb)->nr_frags++; /* increase sk_wmem_alloc */ - base += f->size; - len -= f->size; + base += size; + len -= size; i++; } offset1 = 0; |