mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: becker@scyld.com, Jesper Juhl <jesper.juhl@gmail.com>
Subject: [PATCH] Fix a potential NULL pointer deref in znet
Date: Sun, 19 Mar 2006 01:12:31 +0100	[thread overview]
Message-ID: <200603190112.31828.jesper.juhl@gmail.com> (raw)


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 <jesper.juhl@gmail.com>
---

 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;


		

             reply	other threads:[~2006-03-19  0:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-19  0:12 Jesper Juhl [this message]
2006-03-19  0:46 ` Al Viro
2006-03-19  1:01   ` Jesper Juhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200603190112.31828.jesper.juhl@gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=becker@scyld.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®