Fix a potential NULL pointer dereference in mace_interrupt() in drivers/net/pcmcia...
authorMicah Gruber <micah.gruber@gmail.com>
Tue, 24 Jul 2007 02:44:56 +0000 (10:44 +0800)
committerJeff Garzik <jeff@garzik.org>
Mon, 30 Jul 2007 19:58:54 +0000 (15:58 -0400)
This patch fixes a potential null dereference bug where we dereference
DEV before a null check. This patch simply moves the dereferencing after
the null check.

Signed-off-by: Micah Gruber <micah.gruber@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/pcmcia/nmclan_cs.c

index 73da611fd536b18d93b5f44ecd90602892a98bc0..997c2d0c83bbdbe1f2d765fbc582178d02b84be7 100644 (file)
@@ -996,7 +996,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
 {
   struct net_device *dev = (struct net_device *) dev_id;
   mace_private *lp = netdev_priv(dev);
-  kio_addr_t ioaddr = dev->base_addr;
+  kio_addr_t ioaddr;
   int status;
   int IntrCnt = MACE_MAX_IR_ITERATIONS;
 
@@ -1006,6 +1006,8 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
     return IRQ_NONE;
   }
 
+  ioaddr = dev->base_addr;
+
   if (lp->tx_irq_disabled) {
     printk(
       (lp->tx_irq_disabled?