netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
@ 2007-09-03 22:15 ` Satyam Sharma
  2007-09-03 22:22   ` [PATCH -mm 2/2] 3c59x MAINTAINERS Satyam Sharma
  2007-09-04  8:16   ` [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug Steffen Klassert
  0 siblings, 2 replies; 11+ messages in thread
From: Satyam Sharma @ 2007-09-03 22:15 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Linux Kernel Mailing List, Linux Netdev Mailing List, Jeff Garzik


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 <satyam@infradead.org>

---

 drivers/net/3c59x.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-2.6.23-rc4-mm1/drivers/net/3c59x.c~fix	2007-09-04 03:29:40.000000000 +0530
+++ linux-2.6.23-rc4-mm1/drivers/net/3c59x.c	2007-09-04 03:30:08.000000000 +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 */

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH -mm 2/2] 3c59x MAINTAINERS
  2007-09-03 22:15 ` [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug Satyam Sharma
@ 2007-09-03 22:22   ` Satyam Sharma
  2007-09-04  7:55     ` Steffen Klassert
  2007-09-04  8:16   ` [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug Steffen Klassert
  1 sibling, 1 reply; 11+ messages in thread
From: Satyam Sharma @ 2007-09-03 22:22 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Linux Kernel Mailing List, Linux Netdev Mailing List, Jeff Garzik

Remove duplicate entry for the same driver.

Signed-off-by: Satyam Sharma <satyam@infradead.org>

---

 MAINTAINERS |    6 ------
 1 file changed, 6 deletions(-)

--- linux-2.6.23-rc4-mm1/MAINTAINERS~fix	2007-09-04 03:49:16.000000000 +0530
+++ linux-2.6.23-rc4-mm1/MAINTAINERS	2007-09-04 03:49:28.000000000 +0530
@@ -104,12 +104,6 @@ M:	klassert@mathematik.tu-chemnitz.de
 L:	netdev@vger.kernel.org
 S:	Maintained
 
-3C59X NETWORK DRIVER
-P:	Steffen Klassert
-M:	klassert@mathematik.tu-chemnitz.de
-L:	netdev@vger.kernel.org
-S:	Maintained
-
 3CR990 NETWORK DRIVER
 P:	David Dillow
 M:	dave@thedillows.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH -mm 2/2] 3c59x MAINTAINERS
  2007-09-03 22:22   ` [PATCH -mm 2/2] 3c59x MAINTAINERS Satyam Sharma
@ 2007-09-04  7:55     ` Steffen Klassert
  0 siblings, 0 replies; 11+ messages in thread
From: Steffen Klassert @ 2007-09-04  7:55 UTC (permalink / raw)
  To: Satyam Sharma, Andrew Morton
  Cc: Linux Kernel Mailing List, Linux Netdev Mailing List, Jeff Garzik

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. 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
  2007-09-03 22:15 ` [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug Satyam Sharma
  2007-09-03 22:22   ` [PATCH -mm 2/2] 3c59x MAINTAINERS Satyam Sharma
@ 2007-09-04  8:16   ` Steffen Klassert
  2007-09-04  8:39     ` Satyam Sharma
  2007-09-04  8:53     ` Mark Hindley
  1 sibling, 2 replies; 11+ messages in thread
From: Steffen Klassert @ 2007-09-04  8:16 UTC (permalink / raw)
  To: Satyam Sharma
  Cc: Linux Kernel Mailing List, Linux Netdev Mailing List, Jeff Garzik,
	Mark Hindley

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 <satyam@infradead.org>
Acked-by: Steffen Klassert <klassert@mathematik.tu-chemnitz.de>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
  2007-09-04  8:16   ` [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug Steffen Klassert
@ 2007-09-04  8:39     ` Satyam Sharma
  2007-09-04  8:53     ` Mark Hindley
  1 sibling, 0 replies; 11+ messages in thread
From: Satyam Sharma @ 2007-09-04  8:39 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Linux Kernel Mailing List, Linux Netdev Mailing List, Jeff Garzik,
	Mark Hindley

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 <satyam@infradead.org>
> Acked-by: Steffen Klassert <klassert@mathematik.tu-chemnitz.de>


Thanks,

Satyam

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
  2007-09-04  8:16   ` [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug Steffen Klassert
  2007-09-04  8:39     ` Satyam Sharma
@ 2007-09-04  8:53     ` Mark Hindley
  2007-09-04  9:17       ` Steffen Klassert
                         ` (3 more replies)
  1 sibling, 4 replies; 11+ messages in thread
From: Mark Hindley @ 2007-09-04  8:53 UTC (permalink / raw)
  To: Satyam Sharma
  Cc: Steffen Klassert, Linux Kernel Mailing List,
	Linux Netdev Mailing List, Jeff Garzik

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 <satyam@infradead.org>
> > Acked-by: Steffen Klassert <klassert@mathematik.tu-chemnitz.de>

Acked-by: Mark Hindley <mark@hindley.org.uk>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
  2007-09-04  8:53     ` Mark Hindley
@ 2007-09-04  9:17       ` Steffen Klassert
  2007-09-04  9:35       ` Mark Hindley
                         ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Steffen Klassert @ 2007-09-04  9:17 UTC (permalink / raw)
  To: Mark Hindley
  Cc: Satyam Sharma, Linux Kernel Mailing List,
	Linux Netdev Mailing List, Jeff Garzik

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
  2007-09-04  8:53     ` Mark Hindley
  2007-09-04  9:17       ` Steffen Klassert
@ 2007-09-04  9:35       ` Mark Hindley
  2007-09-04  9:39         ` Steffen Klassert
  2007-09-06  9:55       ` Satyam Sharma
  2007-09-06 21:40       ` Mark Hindley
  3 siblings, 1 reply; 11+ messages in thread
From: Mark Hindley @ 2007-09-04  9:35 UTC (permalink / raw)
  To: Steffen Klassert
  Cc: Satyam Sharma, Linux Kernel Mailing List,
	Linux Netdev Mailing List, Jeff Garzik

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
  2007-09-04  9:35       ` Mark Hindley
@ 2007-09-04  9:39         ` Steffen Klassert
  0 siblings, 0 replies; 11+ messages in thread
From: Steffen Klassert @ 2007-09-04  9:39 UTC (permalink / raw)
  To: Mark Hindley
  Cc: Satyam Sharma, Linux Kernel Mailing List,
	Linux Netdev Mailing List, Jeff Garzik

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
  2007-09-04  8:53     ` Mark Hindley
  2007-09-04  9:17       ` Steffen Klassert
  2007-09-04  9:35       ` Mark Hindley
@ 2007-09-06  9:55       ` Satyam Sharma
  2007-09-06 21:40       ` Mark Hindley
  3 siblings, 0 replies; 11+ messages in thread
From: Satyam Sharma @ 2007-09-06  9:55 UTC (permalink / raw)
  To: Mark Hindley
  Cc: Steffen Klassert, Linux Kernel Mailing List,
	Linux Netdev Mailing List, Jeff Garzik



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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug
  2007-09-04  8:53     ` Mark Hindley
                         ` (2 preceding siblings ...)
  2007-09-06  9:55       ` Satyam Sharma
@ 2007-09-06 21:40       ` Mark Hindley
  3 siblings, 0 replies; 11+ messages in thread
From: Mark Hindley @ 2007-09-06 21:40 UTC (permalink / raw)
  To: Satyam Sharma
  Cc: Steffen Klassert, Linux Kernel Mailing List,
	Linux Netdev Mailing List, Jeff Garzik

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-09-06 21:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <alpine.LFD.0.999.0709040340250.8504@enigma.security.iitk.ac.in >
2007-09-03 22:15 ` [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug Satyam Sharma
2007-09-03 22:22   ` [PATCH -mm 2/2] 3c59x MAINTAINERS Satyam Sharma
2007-09-04  7:55     ` Steffen Klassert
2007-09-04  8:16   ` [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug Steffen Klassert
2007-09-04  8:39     ` Satyam Sharma
2007-09-04  8:53     ` Mark Hindley
2007-09-04  9:17       ` Steffen Klassert
2007-09-04  9:35       ` Mark Hindley
2007-09-04  9:39         ` Steffen Klassert
2007-09-06  9:55       ` Satyam Sharma
2007-09-06 21:40       ` Mark Hindley

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).