netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix possible null pointer dereference in ariadne.c
@ 2011-03-01 11:33 huzaifas
  2011-03-01 19:53 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: huzaifas @ 2011-03-01 11:33 UTC (permalink / raw)
  To: netdev; +Cc: geert, tj, davem, eric.dumazet, Huzaifa Sidhpurwala

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix possible null pointer dereference in ariadne.c
  2011-03-01 11:33 [PATCH] Fix possible null pointer dereference in ariadne.c huzaifas
@ 2011-03-01 19:53 ` David Miller
  2011-03-02  4:47   ` Huzaifa Sidhpurwala
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2011-03-01 19:53 UTC (permalink / raw)
  To: huzaifas; +Cc: netdev, geert, tj, eric.dumazet

From: huzaifas@redhat.com
Date: Tue,  1 Mar 2011 17:03:27 +0530

> +    *lance = (struct Am79C960*)dev->base_addr;

If you had actually compiled this, the compiler would have given
you a warning shoing that the leading "*" in "*lance" is not
appropriate for this assignment.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix possible null pointer dereference in ariadne.c
  2011-03-01 19:53 ` David Miller
@ 2011-03-02  4:47   ` Huzaifa Sidhpurwala
  0 siblings, 0 replies; 3+ messages in thread
From: Huzaifa Sidhpurwala @ 2011-03-02  4:47 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, geert, tj, eric.dumazet

On 03/02/2011 01:23 AM, David Miller wrote:
> From: huzaifas@redhat.com
> Date: Tue,  1 Mar 2011 17:03:27 +0530
> 
>> +    *lance = (struct Am79C960*)dev->base_addr;
> 
> If you had actually compiled this, the compiler would have given
> you a warning shoing that the leading "*" in "*lance" is not
> appropriate for this assignment.
i did build, but looks like something happened after that :(
Sorry about the mess-up , will repost the patch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-02  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01 11:33 [PATCH] Fix possible null pointer dereference in ariadne.c huzaifas
2011-03-01 19:53 ` David Miller
2011-03-02  4:47   ` Huzaifa Sidhpurwala

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).