Skip to contentSkip to conversation

Avoid possible NULL pointer deref in 3c359 driver

PATCH In review [email protected] 1 participant 1 message Oct 2, 2007

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

PATCH 4/13 Avoid possible NULL pointer deref in 3c359 driver

From: Jesper Juhl <[email protected]>

In xl_freemem(), if dev_if is NULL, the line

  struct xl_private *xl_priv =(struct xl_private *)dev->priv;

will cause a NULL pointer dereference.

(akpm: don't try to fix it: just delete the pointless test-for-null)

---

 drivers/net/tokenring/3c359.c |    5 -----
 1 file changed, 5 deletions(-)
drivers/net/tokenring/3c359.c renamed from drivers/net/tokenring/3c359.c~avoid-possible-null-pointer-deref-in-3c359-driver +0 -5
diff -puN drivers/net/tokenring/3c359.c~avoid-possible-null-pointer-deref-in-3c359-driver drivers/net/tokenring/3c359.c
@@ -1045,11 +1045,6 @@ static irqreturn_t xl_interrupt(int irq,
 	u8 __iomem * xl_mmio = xl_priv->xl_mmio ; 
 	u16 intstatus, macstatus  ;
 
-	if (!dev) { 
-		printk(KERN_WARNING "Device structure dead, aaahhhh !\n") ;
-		return IRQ_NONE; 
-	}
-
 	intstatus = readw(xl_mmio + MMIO_INTSTATUS) ;  
 
 	if (!(intstatus & 1)) /* We didn't generate the interrupt */

_