* [PATCH] macvtap: fix the uninitialized var using in macvtap_alloc_skb()
@ 2011-09-19 9:48 Jason Wang
2011-09-19 9:54 ` Michael S. Tsirkin
0 siblings, 1 reply; 4+ messages in thread
From: Jason Wang @ 2011-09-19 9:48 UTC (permalink / raw)
To: netdev, mst, davem, linux-kernel
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>
---
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;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] macvtap: fix the uninitialized var using in macvtap_alloc_skb()
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
2011-09-20 10:58 ` Ian Campbell
0 siblings, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2011-09-19 9:54 UTC (permalink / raw)
To: Jason Wang; +Cc: netdev, davem, linux-kernel
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;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] macvtap: fix the uninitialized var using in macvtap_alloc_skb()
2011-09-19 9:54 ` Michael S. Tsirkin
@ 2011-09-20 10:58 ` Ian Campbell
2011-09-20 18:48 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2011-09-20 10:58 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Jason Wang, netdev, davem, linux-kernel, Dan Carpenter
On Mon, 2011-09-19 at 12:54 +0300, Michael S. Tsirkin wrote:
> 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>
Agreed. I like this one better than the one I just sent out so:
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Thanks Jason.
>
> > ---
> > 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;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] macvtap: fix the uninitialized var using in macvtap_alloc_skb()
2011-09-20 10:58 ` Ian Campbell
@ 2011-09-20 18:48 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-09-20 18:48 UTC (permalink / raw)
To: Ian.Campbell; +Cc: mst, jasowang, netdev, linux-kernel, dan.carpenter
From: Ian Campbell <Ian.Campbell@citrix.com>
Date: Tue, 20 Sep 2011 11:58:03 +0100
> On Mon, 2011-09-19 at 12:54 +0300, Michael S. Tsirkin wrote:
>> 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>
>
> Agreed. I like this one better than the one I just sent out so:
>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-20 18:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-09-20 10:58 ` Ian Campbell
2011-09-20 18:48 ` David Miller
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).