From: Jesper Juhl Date: Sat, 29 Sep 2007 05:42:09 +0000 (-0700) Subject: Avoid possible NULL pointer deref in 3c359 driver X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=bcfef8c3681fa59b653871682956a8fdf5c27c5a;p=openwrt%2Fstaging%2Fblogic.git Avoid possible NULL pointer deref in 3c359 driver 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) Signed-off-by: Jesper Juhl Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c index 88d03c085d54..7224d368b2a7 100644 --- a/drivers/net/tokenring/3c359.c +++ b/drivers/net/tokenring/3c359.c @@ -1045,11 +1045,6 @@ static irqreturn_t xl_interrupt(int irq, void *dev_id) 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 */