All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix a potential NULL pointer deref in znet
@ 2006-03-19  0:12 Jesper Juhl
  2006-03-19  0:46 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2006-03-19  0:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: becker, Jesper Juhl


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;


		

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

* Re: [PATCH] Fix a potential NULL pointer deref in znet
  2006-03-19  0:12 [PATCH] Fix a potential NULL pointer deref in znet Jesper Juhl
@ 2006-03-19  0:46 ` Al Viro
  2006-03-19  1:01   ` Jesper Juhl
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2006-03-19  0:46 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-kernel, becker

On Sun, Mar 19, 2006 at 01:12:31AM +0100, Jesper Juhl wrote:
> 
> 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.

The hell it does.  Either interrupt really isn't shared, in which case
this check should be simply removed, or it can be shared, in which case
the code is still buggered.

Please, stop pulling Bunk - _think_ before submitting "make <program> STFU"
patches.

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

* Re: [PATCH] Fix a potential NULL pointer deref in znet
  2006-03-19  0:46 ` Al Viro
@ 2006-03-19  1:01   ` Jesper Juhl
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2006-03-19  1:01 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-kernel, becker

On 3/19/06, Al Viro <viro@ftp.linux.org.uk> wrote:
> On Sun, Mar 19, 2006 at 01:12:31AM +0100, Jesper Juhl wrote:
> >
> > 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.
>
> The hell it does.  Either interrupt really isn't shared, in which case
> this check should be simply removed, or it can be shared, in which case
> the code is still buggered.
>
> Please, stop pulling Bunk - _think_ before submitting "make <program> STFU"
> patches.
>

Believe it or not,  but I actually do try to think about the patches I submit.
I make mistakes sometimes and I don't know all the code in as much
depth as I would like, but I do try to help out the best I can.

I appreciate feedback on the work I do, and I try to improve based on
it - this means I also value your feedback although I must say I
dislike your tone.

I'll stare at the code some more and try to come up with a better
patch after I've had some sleep.

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

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

end of thread, other threads:[~2006-03-19  1:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-19  0:12 [PATCH] Fix a potential NULL pointer deref in znet Jesper Juhl
2006-03-19  0:46 ` Al Viro
2006-03-19  1:01   ` Jesper Juhl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.