Skip to content

Commit 653fc91

Browse files
Jason Wangdavem330
authored andcommitted
macvtap: fix the uninitialized var using in macvtap_alloc_skb()
Commit d1b0828 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>
1 parent 59da45c commit 653fc91

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎drivers/net/macvtap.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
453453
int copy = skb_headlen(skb);
454454
int size, offset1 = 0;
455455
int i = 0;
456-
skb_frag_t *f;
457456

458457
/* Skip over from offset */
459458
while (count && (offset >= from->iov_len)) {
@@ -503,14 +502,13 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
503502
skb->truesize += len;
504503
atomic_add(len, &skb->sk->sk_wmem_alloc);
505504
while (len) {
506-
__skb_fill_page_desc(
507-
skb, i, page[i],
508-
base & ~PAGE_MASK,
509-
min_t(int, len, PAGE_SIZE - f->page_offset));
505+
int off = base & ~PAGE_MASK;
506+
int size = min_t(int, len, PAGE_SIZE - off);
507+
__skb_fill_page_desc(skb, i, page[i], off, size);
510508
skb_shinfo(skb)->nr_frags++;
511509
/* increase sk_wmem_alloc */
512-
base += f->size;
513-
len -= f->size;
510+
base += size;
511+
len -= size;
514512
i++;
515513
}
516514
offset1 = 0;

0 commit comments

Comments
 (0)