drivers/net/3c59x.c: In function 'vortex_up':
drivers/net/3c59x.c:1495: warning: 'err' may be used uninitialized in this function
is a genuine bug. The function returns an uninitialized value of 'err'
back to the caller, which expects it to be 0 for success cases. Let's
fix this by explicitly initializing 'err' to zero.
Signed-off-by: Satyam Sharma <redacted>
---
drivers/net/3c59x.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -1492,7 +1492,8 @@ vortex_up(struct net_device *dev)structvortex_private*vp=netdev_priv(dev);void__iomem*ioaddr=vp->ioaddr;unsignedintconfig;-inti,mii_reg1,mii_reg5,err;+inti,mii_reg1,mii_reg5;+interr=0;if(VORTEX_PCI(vp)){pci_set_power_state(VORTEX_PCI(vp),PCI_D0);/* Go active */
On Tue, Sep 04, 2007 at 03:45:55AM +0530, Satyam Sharma wrote:
drivers/net/3c59x.c: In function 'vortex_up':
drivers/net/3c59x.c:1495: warning: 'err' may be used uninitialized in this function
This came in with the recently applied 3c59x-check-return-of-pci_enable_device patch
from Mark Hindley. I just compiled it on a PCI only machine so far, therefore I did
not notice the warning yet.
is a genuine bug. The function returns an uninitialized value of 'err'
back to the caller, which expects it to be 0 for success cases. Let's
fix this by explicitly initializing 'err' to zero.
Signed-off-by: Satyam Sharma <redacted>
On Tue, Sep 04, 2007 at 03:52:50AM +0530, Satyam Sharma wrote:
Remove duplicate entry for the same driver.
This is -mm specific. Andrew did not remove the add-3c59x-maintainer
patch after pushing it to mainline. This can be fixed just by removing
the add-3c59x-maintainer patch from -mm.
Hi Steffen,
On Tue, 4 Sep 2007, Steffen Klassert wrote:
On Tue, Sep 04, 2007 at 03:45:55AM +0530, Satyam Sharma wrote:
quoted
drivers/net/3c59x.c: In function 'vortex_up':
drivers/net/3c59x.c:1495: warning: 'err' may be used uninitialized in this function
This came in with the recently applied 3c59x-check-return-of-pci_enable_device patch
from Mark Hindley. I just compiled it on a PCI only machine so far, therefore I did
not notice the warning yet.
Hmm, the .config I built with had PCI=y as well. Probably a compiler
version difference -- Jeff also mentioned yesterday that some newer
GCC versions fail to warn about uninitialized variables cases.
quoted
is a genuine bug. The function returns an uninitialized value of 'err'
back to the caller, which expects it to be 0 for success cases. Let's
fix this by explicitly initializing 'err' to zero.
Signed-off-by: Satyam Sharma <redacted>
From: Mark Hindley <hidden> Date: 2007-09-04 08:55:09
On Tue, Sep 04, 2007 at 02:09:47PM +0530, Satyam Sharma wrote:
Hi Steffen,
On Tue, 4 Sep 2007, Steffen Klassert wrote:
quoted
On Tue, Sep 04, 2007 at 03:45:55AM +0530, Satyam Sharma wrote:
quoted
drivers/net/3c59x.c: In function 'vortex_up':
drivers/net/3c59x.c:1495: warning: 'err' may be used uninitialized in this function
This came in with the recently applied 3c59x-check-return-of-pci_enable_device patch
from Mark Hindley. I just compiled it on a PCI only machine so far, therefore I did
not notice the warning yet.
Hmm, the .config I built with had PCI=y as well. Probably a compiler
version difference -- Jeff also mentioned yesterday that some newer
GCC versions fail to warn about uninitialized variables cases.
Sorry, this is my bad. I have just checked: there is no warning with gcc
4.2 or 4.1, but 3.3 emits the warning.
quoted
quoted
is a genuine bug. The function returns an uninitialized value of 'err'
back to the caller, which expects it to be 0 for success cases. Let's
fix this by explicitly initializing 'err' to zero.
Signed-off-by: Satyam Sharma <redacted>
On Tue, Sep 04, 2007 at 09:53:31AM +0100, Mark Hindley wrote:
On Tue, Sep 04, 2007 at 02:09:47PM +0530, Satyam Sharma wrote:
quoted
Hi Steffen,
On Tue, 4 Sep 2007, Steffen Klassert wrote:
quoted
On Tue, Sep 04, 2007 at 03:45:55AM +0530, Satyam Sharma wrote:
quoted
drivers/net/3c59x.c: In function 'vortex_up':
drivers/net/3c59x.c:1495: warning: 'err' may be used uninitialized in this function
This came in with the recently applied 3c59x-check-return-of-pci_enable_device patch
from Mark Hindley. I just compiled it on a PCI only machine so far, therefore I did
not notice the warning yet.
Hmm, the .config I built with had PCI=y as well. Probably a compiler
version difference -- Jeff also mentioned yesterday that some newer
GCC versions fail to warn about uninitialized variables cases.
Sorry, this is my bad. I have just checked: there is no warning with gcc
4.2 or 4.1, but 3.3 emits the warning.
The only warning that I was able to trigger with gcc 4.2 is in the case of a .config
without PCI support. In this case I get
drivers/net/3c59x.c: In function 'vortex_up':
drivers/net/3c59x.c:1672: warning: 'err' is used uninitialized in this function
^^
So we have to be more carefull with the newer gcc versions.
Steffen
From: Mark Hindley <hidden> Date: 2007-09-04 09:35:28
On Tue, Sep 04, 2007 at 11:17:57AM +0200, Steffen Klassert wrote:
The only warning that I was able to trigger with gcc 4.2 is in the case of a .config
without PCI support. In this case I get
drivers/net/3c59x.c: In function 'vortex_up':
drivers/net/3c59x.c:1672: warning: 'err' is used uninitialized in this function
On Tue, Sep 04, 2007 at 10:35:10AM +0100, Mark Hindley wrote:
On Tue, Sep 04, 2007 at 11:17:57AM +0200, Steffen Klassert wrote:
quoted
The only warning that I was able to trigger with gcc 4.2 is in the case of a .config
without PCI support. In this case I get
drivers/net/3c59x.c: In function 'vortex_up':
drivers/net/3c59x.c:1672: warning: 'err' is used uninitialized in this function
That should be fixed by Satyam's patch too.
Yes, of course.
This was just to point out what's possible to trigger with a newer gcc and what's not.
Steffen
On Tue, Sep 04, 2007 at 02:09:47PM +0530, Satyam Sharma wrote:
quoted
Hi Steffen,
On Tue, 4 Sep 2007, Steffen Klassert wrote:
quoted
On Tue, Sep 04, 2007 at 03:45:55AM +0530, Satyam Sharma wrote:
quoted
drivers/net/3c59x.c: In function 'vortex_up':
drivers/net/3c59x.c:1495: warning: 'err' may be used uninitialized in this function
This came in with the recently applied 3c59x-check-return-of-pci_enable_device patch
from Mark Hindley. I just compiled it on a PCI only machine so far, therefore I did
not notice the warning yet.
Hmm, the .config I built with had PCI=y as well. Probably a compiler
version difference -- Jeff also mentioned yesterday that some newer
GCC versions fail to warn about uninitialized variables cases.
Sorry, this is my bad. I have just checked: there is no warning with gcc
4.2 or 4.1, but 3.3 emits the warning.
This is a GCC bug (regression, actually, as you've found out) -- no two
ways about it. Although different from the kind Jeff mentioned couple days
back -- that was about wising GCC up to false positives and /not/ emitting
warnings. But here a genuine problem was not complained about, so this is
more serious. Do you plan to open up a bug at gcc.gnu.org/bugzilla/ ?
Satyam
From: Mark Hindley <hidden> Date: 2007-09-06 21:40:43
On Thu, Sep 06, 2007 at 03:25:55PM +0530, Satyam Sharma wrote:
This is a GCC bug (regression, actually, as you've found out) -- no two
ways about it. Although different from the kind Jeff mentioned couple days
back -- that was about wising GCC up to false positives and /not/ emitting
warnings. But here a genuine problem was not complained about, so this is
more serious. Do you plan to open up a bug at gcc.gnu.org/bugzilla/ ?
Yes, I have just narrowed down a test case, which is remarkably simple!
int
main(int i)
{
int err;
if (i) {
err = 1;
}
return err;
}
Mark