Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jason Wang and committed by
David S. Miller
653fc915 59da45c4

+5 -7
+5 -7
drivers/net/macvtap.c
··· 453 453 int copy = skb_headlen(skb); 454 454 int size, offset1 = 0; 455 455 int i = 0; 456 - skb_frag_t *f; 457 456 458 457 /* Skip over from offset */ 459 458 while (count && (offset >= from->iov_len)) { ··· 502 503 skb->truesize += len; 503 504 atomic_add(len, &skb->sk->sk_wmem_alloc); 504 505 while (len) { 505 - __skb_fill_page_desc( 506 - skb, i, page[i], 507 - base & ~PAGE_MASK, 508 - min_t(int, len, PAGE_SIZE - f->page_offset)); 506 + int off = base & ~PAGE_MASK; 507 + int size = min_t(int, len, PAGE_SIZE - off); 508 + __skb_fill_page_desc(skb, i, page[i], off, size); 509 509 skb_shinfo(skb)->nr_frags++; 510 510 /* increase sk_wmem_alloc */ 511 - base += f->size; 512 - len -= f->size; 511 + base += size; 512 + len -= size; 513 513 i++; 514 514 } 515 515 offset1 = 0;