[PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Steffen Klassert <klassert@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Linux Netdev Mailing List <netdev@...>, Jeff Garzik <jeff@...>
Date: Monday, September 3, 2007 - 6:15 pm

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 */
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug, Satyam Sharma, (Mon Sep 3, 6:15 pm)
Re: [PATCH -mm 1/2] 3c59x: Fix uninitialized variable bug, Steffen Klassert, (Tue Sep 4, 4:16 am)
[PATCH -mm 2/2] 3c59x MAINTAINERS, Satyam Sharma, (Mon Sep 3, 6:22 pm)
Re: [PATCH -mm 2/2] 3c59x MAINTAINERS, Steffen Klassert, (Tue Sep 4, 3:55 am)