2009-04-23 07:24:22

by David Miller

[permalink] [raw]
Subject: Re: linux-next: upstream tree build warnings

From: Stephen Rothwell <[email protected]>
Date: Thu, 23 Apr 2009 16:38:47 +1000

> Today's linux-next build (powerpc allyesconfig gcc4.4.0) produced these
> warnings:
>
> drivers/net/virtio_net.c: In function 'virnet_vlan_rx_add_vid':
> include/linux/scatterlist.h:57: warning: 'sg' is used uninitialized in this function
> drivers/net/virtio_net.c:746: note: 'sg' was declared here
> drivers/net/virtio_net.c: In function 'virnet_vlan_rx_kill_vid':
> include/linux/scatterlist.h:57: warning: 'sg' is used uninitialized in this function
> drivers/net/virtio_net.c:758: note: 'sg' was declared here
>
> in each case, sg is uninitialised when its address is passed to
> sg_set_buf() which passes it to gs_set_page() which passes it to
> sg_assign_page() which dereferences it (to use ->page_link).

I wonder if this is a side effect of changes that went in via Rusty's
tree? I don't remember touching this driver in a while.


2009-04-23 11:55:55

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: upstream tree build warnings

Hi Dave,

On Thu, 23 Apr 2009 00:24:03 -0700 (PDT) David Miller <[email protected]> wrote:
>
> From: Stephen Rothwell <[email protected]>
> Date: Thu, 23 Apr 2009 16:38:47 +1000
>
> > Today's linux-next build (powerpc allyesconfig gcc4.4.0) produced these
> > warnings:
> >
> > drivers/net/virtio_net.c: In function 'virnet_vlan_rx_add_vid':
> > include/linux/scatterlist.h:57: warning: 'sg' is used uninitialized in this function
> > drivers/net/virtio_net.c:746: note: 'sg' was declared here
> > drivers/net/virtio_net.c: In function 'virnet_vlan_rx_kill_vid':
> > include/linux/scatterlist.h:57: warning: 'sg' is used uninitialized in this function
> > drivers/net/virtio_net.c:758: note: 'sg' was declared here
> >
> > in each case, sg is uninitialised when its address is passed to
> > sg_set_buf() which passes it to gs_set_page() which passes it to
> > sg_assign_page() which dereferences it (to use ->page_link).
>
> I wonder if this is a side effect of changes that went in via Rusty's
> tree? I don't remember touching this driver in a while.

The callers came in throught commit
0bde95690d65653e420d04856c5d5783155c747c ("virtio_net: Add support for
VLAN filtering in the hypervisor") which I assume came in throught the
net tree (it has you SOB on it). Committed Feb 5, 2009, went into Linus'
tree before 2.6.30-rc1.

scatterlist.h hasn't changed since July, 2008.

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (1.46 kB)
(No filename) (197.00 B)
Download all attachments

2009-04-23 12:51:27

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: upstream tree build warnings

Hi Dave,

On Thu, 23 Apr 2009 21:55:33 +1000 Stephen Rothwell <[email protected]> wrote:
>
> The callers came in throught commit
> 0bde95690d65653e420d04856c5d5783155c747c ("virtio_net: Add support for
> VLAN filtering in the hypervisor") which I assume came in throught the
> net tree (it has you SOB on it). Committed Feb 5, 2009, went into Linus'
> tree before 2.6.30-rc1.
>
> scatterlist.h hasn't changed since July, 2008.

In other words, I think the bug has always been there and just never hit
(yet).

--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/


Attachments:
(No filename) (616.00 B)
(No filename) (197.00 B)
Download all attachments

2009-04-23 16:47:35

by Alex Williamson

[permalink] [raw]
Subject: Re: linux-next: upstream tree build warnings

On Thu, 2009-04-23 at 22:51 +1000, Stephen Rothwell wrote:
> Hi Dave,
>
> On Thu, 23 Apr 2009 21:55:33 +1000 Stephen Rothwell <[email protected]> wrote:
> >
> > The callers came in throught commit
> > 0bde95690d65653e420d04856c5d5783155c747c ("virtio_net: Add support for
> > VLAN filtering in the hypervisor") which I assume came in throught the
> > net tree (it has you SOB on it). Committed Feb 5, 2009, went into Linus'
> > tree before 2.6.30-rc1.
> >
> > scatterlist.h hasn't changed since July, 2008.
>
> In other words, I think the bug has always been there and just never hit
> (yet).

Hmm, I can't seem to get the warning on an x86_64 allyesconfig build
with gcc-4.4.0. Did all the archs other than powerpc miss this warning?
Thanks,

Alex

2009-04-26 12:23:27

by Rusty Russell

[permalink] [raw]
Subject: Re: linux-next: upstream tree build warnings

On Thu, 23 Apr 2009 04:54:03 pm David Miller wrote:
> From: Stephen Rothwell <[email protected]>
> Date: Thu, 23 Apr 2009 16:38:47 +1000
>
> > Today's linux-next build (powerpc allyesconfig gcc4.4.0) produced these
> > warnings:
> >
> > drivers/net/virtio_net.c: In function 'virnet_vlan_rx_add_vid':
> > include/linux/scatterlist.h:57: warning: 'sg' is used uninitialized in this function
> > drivers/net/virtio_net.c:746: note: 'sg' was declared here
> > drivers/net/virtio_net.c: In function 'virnet_vlan_rx_kill_vid':
> > include/linux/scatterlist.h:57: warning: 'sg' is used uninitialized in this function
> > drivers/net/virtio_net.c:758: note: 'sg' was declared here
> >
> > in each case, sg is uninitialised when its address is passed to
> > sg_set_buf() which passes it to gs_set_page() which passes it to
> > sg_assign_page() which dereferences it (to use ->page_link).
>
> I wonder if this is a side effect of changes that went in via Rusty's
> tree? I don't remember touching this driver in a while.

AFAICT gcc is right: it should be sg_init_one().

It doesn't currently *matter*, since no virtio add_buf implementation
does that chained-sg crap (I had a patch once, but it made me barf) and
so the uninitialized lower three bits are ignored.

Alex, if you agree, patch welcome...
Rusty.

2009-04-27 06:32:59

by David Miller

[permalink] [raw]
Subject: Re: linux-next: upstream tree build warnings

From: Rusty Russell <[email protected]>
Date: Sun, 26 Apr 2009 21:53:10 +0930

> Alex, if you agree, patch welcome...

And please CC: netdev properly so that the patch gets tracked
in patchwork, thanks.