Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
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 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
On Tue, 4 Sep 2007, Mark Hindley wrote: > On Tue, Sep 04, 2007 at 02:09:47PM +0530, Satyam Sharma wrote: > > Hi Steffen, > > > > > > On Tue, 4 Sep 2007, Steffen Klassert wrote: > > > > > 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. > > > > 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 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
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: > > > 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 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
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 That should be fixed by Satyam's patch too. Mark - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
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: > > Hi Steffen, > > > > > > On Tue, 4 Sep 2007, Steffen Klassert wrote: > > > > > 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. > > > > 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 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
On Tue, Sep 04, 2007 at 02:09:47PM +0530, Satyam Sharma wrote: > Hi Steffen, > > > On Tue, 4 Sep 2007, Steffen Klassert wrote: > > > 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. > > 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. > > > > 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 <[EMAIL PROTECTED]> > > Acked-by: Steffen Klassert <[EMAIL PROTECTED]> Acked-by: Mark Hindley <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
Hi Steffen, On Tue, 4 Sep 2007, Steffen Klassert wrote: > 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. 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. > > 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 <[EMAIL PROTECTED]> > Acked-by: Steffen Klassert <[EMAIL PROTECTED]> Thanks, Satyam - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
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 <[EMAIL PROTECTED]> Acked-by: Steffen Klassert <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
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 <[EMAIL PROTECTED]> --- drivers/net/3c59x.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- linux-2.6.23-rc4-mm1/drivers/net/3c59x.c~fix2007-09-04 03:29:40.0 +0530 +++ linux-2.6.23-rc4-mm1/drivers/net/3c59x.c2007-09-04 03:30:08.0 +0530 @@ -1492,7 +1492,8 @@ vortex_up(struct net_device *dev) struct vortex_private *vp = netdev_priv(dev); void __iomem *ioaddr = vp->ioaddr; unsigned int config; - int i, mii_reg1, mii_reg5, err; + int i, mii_reg1, mii_reg5; + int err = 0; if (VORTEX_PCI(vp)) { pci_set_power_state(VORTEX_PCI(vp), PCI_D0);/* Go active */ - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html