[PATCH] Fix a potential NULL pointer deref in znet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The coverity checker spotted that we dereference a pointer before we check it
for NULL in drivers/net/znet.c::znet_interrupt().
This fixes the issue.


Signed-off-by: Jesper Juhl <[email protected]>
---

 drivers/net/znet.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

--- linux-2.6.16-rc6-orig/drivers/net/znet.c	2006-01-03 04:21:10.000000000 +0100
+++ linux-2.6.16-rc6/drivers/net/znet.c	2006-03-19 01:08:01.000000000 +0100
@@ -606,17 +606,20 @@ static int znet_send_packet(struct sk_bu
 /* The ZNET interrupt handler. */
 static irqreturn_t znet_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 {
-	struct net_device *dev = dev_id;
-	struct znet_private *znet = dev->priv;
+	struct net_device *dev;
+	struct znet_private *znet;
 	int ioaddr;
 	int boguscnt = 20;
 	int handled = 0;
 
-	if (dev == NULL) {
+	if (dev_id == NULL) {
 		printk(KERN_WARNING "znet_interrupt(): IRQ %d for unknown device.\n", irq);
 		return IRQ_NONE;
 	}
 
+	dev = dev_id;
+	znet = dev->priv;
+
 	spin_lock (&znet->lock);
 	
 	ioaddr = dev->base_addr;


		
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux