netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: huzaifas@redhat.com
To: netdev@vger.kernel.org
Cc: geert@linux-m68k.org, tj@kernel.org, davem@davemloft.net,
	eric.dumazet@gmail.com, Huzaifa Sidhpurwala <huzaifas@redhat.com>
Subject: [PATCH] Fix possible null pointer dereference in ariadne.c
Date: Tue,  1 Mar 2011 17:03:27 +0530	[thread overview]
Message-ID: <1298979207-11237-1-git-send-email-huzaifas@redhat.com> (raw)

From: Huzaifa Sidhpurwala <huzaifas@redhat.com>

Make sure dev exists before referencing it

Signed-off-by: Huzaifa Sidhpurwala <huzaifas@redhat.com>
---
 drivers/net/ariadne.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index 39214e5..fc3c762 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -420,7 +420,7 @@ static inline void ariadne_reset(struct net_device *dev)
 static irqreturn_t ariadne_interrupt(int irq, void *data)
 {
     struct net_device *dev = (struct net_device *)data;
-    volatile struct Am79C960 *lance = (struct Am79C960*)dev->base_addr;
+    volatile struct Am79C960 *lance;
     struct ariadne_private *priv;
     int csr0, boguscnt;
     int handled = 0;
@@ -430,6 +430,7 @@ static irqreturn_t ariadne_interrupt(int irq, void *data)
 	return IRQ_NONE;
     }
 
+    *lance = (struct Am79C960*)dev->base_addr;
     lance->RAP = CSR0;			/* PCnet-ISA Controller Status */
 
     if (!(lance->RDP & INTR))		/* Check if any interrupt has been */
-- 
1.7.3.4


             reply	other threads:[~2011-03-01 11:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 11:33 huzaifas [this message]
2011-03-01 19:53 ` [PATCH] Fix possible null pointer dereference in ariadne.c David Miller
2011-03-02  4:47   ` Huzaifa Sidhpurwala

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=1298979207-11237-1-git-send-email-huzaifas@redhat.com \
    --to=huzaifas@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=netdev@vger.kernel.org \
    --cc=tj@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;
as well as URLs for NNTP newsgroup(s).