Skip to contentSkip to conversation

r8169: Fix iteration variable sign

PATCH New Michael Buesch 3 participants 5 messages Nov 29, 2006 – Nov 30, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 r8169: Fix iteration variable sign

This changes the type of variable "i" in rtl8169_init_one() from "unsigned int" to "int". "i" is checked for <0 later, which can never happen for "unsigned". This results in broken error handling.

drivers/net/r8169.c +2 -2
Index: linux-2.6/drivers/net/r8169.c
===================================================================
@@ -1473,8 +1473,8 @@ rtl8169_init_one(struct pci_dev *pdev, c
 	struct rtl8169_private *tp;
 	struct net_device *dev;
 	void __iomem *ioaddr;
-	unsigned int i, pm_cap;
-	int rc;
+	unsigned int pm_cap;
+	int i, rc;
 
 	if (netif_msg_drv(&debug)) {
 		printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n",
Signature · 1 line
Greetings Michael.
#1 lore raw

PATCH 1/1 r8169: Fix iteration variable sign

This changes the type of variable "i" in rtl8169_init_one() from "unsigned int" to "int". "i" is checked for < 0 later, which can never happen for "unsigned". This results in broken error handling.

drivers/net/r8169.c +2 -2
index 5002673..c8fa9b1 100644
@@ -1491,8 +1491,8 @@ rtl8169_init_one(struct pci_dev *pdev, c
 	struct rtl8169_private *tp;
 	struct net_device *dev;
 	void __iomem *ioaddr;
-	unsigned int i, pm_cap;
-	int rc;
+	unsigned int pm_cap;
+	int i, rc;
 
 	if (netif_msg_drv(&debug)) {
 		printk(KERN_INFO "%s Gigabit Ethernet driver %s loaded\n",
#2 lore raw
Quoted 7 lines · Francois Romieu

This changes the type of variable "i" in rtl8169_init_one() from "unsigned int" to "int". "i" is checked for < 0 later, which can never happen for "unsigned". This results in broken error handling.

ACK but doesn't seem to apply to 2.6.19?

should this go into #upstream rather than #upstream-fixes?

#3 lore raw
Quoted 6 lines · Jeff Garzik
Quoted 5 lines · Francois Romieu

This changes the type of variable "i" in rtl8169_init_one() from "unsigned int" to "int". "i" is checked for < 0 later, which can never happen for "unsigned". This results in broken error handling.

Quoted 6 lines
Quoted 2 lines

ACK but doesn't seem to apply to 2.6.19?

should this go into #upstream rather than #upstream-fixes?

Hm, I did this against latest linus' tree.

Signature · 1 line
Greetings Michael.