From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] macvtap: fix the uninitialized var using in macvtap_alloc_skb()
Date: Mon, 19 Sep 2011 12:54:15 +0300 [thread overview]
Message-ID: <20110919095415.GD4501@redhat.com> (raw)
In-Reply-To: <20110919094830.6272.40503.stgit@dhcp-91-7.nay.redhat.com.englab.nay.redhat.com>
On Mon, Sep 19, 2011 at 05:48:31PM +0800, Jason Wang wrote:
> 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>
Good catch. Makes absolute sense.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 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 7c3f84a..3da5578 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;
next prev parent reply other threads:[~2011-09-19 9:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-19 9:48 [PATCH] macvtap: fix the uninitialized var using in macvtap_alloc_skb() Jason Wang
2011-09-19 9:54 ` Michael S. Tsirkin [this message]
2011-09-20 10:58 ` Ian Campbell
2011-09-20 18:48 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110919095415.GD4501@redhat.com \
--to=mst@redhat.com \
--cc=davem@davemloft.net \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).