Devicetree
 help / color / mirror / Atom feed
* [PATCH 3/11] arch/sparc/kernel: Eliminate what looks like a NULL pointer dereference
@ 2010-05-27 12:32 Julia Lawall
  2010-06-04 23:17 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2010-05-27 12:32 UTC (permalink / raw)
  To: David S. Miller, Grant Likely, sparclinux, linux-kernel,
	devicetree-discuss

From: Julia Lawall <julia@diku.dk>

At the point of the test, action cannot be NULL, as it has been dereferenced
in the code just above.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@r exists@
expression E,E1;
identifier f;
statement S1,S2,S3;
@@

if ((E == NULL && ...) || ...)
{
  ... when != if (...) S1 else S2
      when != E = E1
* E->f
  ... when any
}
else S3
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 arch/sparc/kernel/sun4d_irq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/sun4d_irq.c b/arch/sparc/kernel/sun4d_irq.c
index ab036a7..e11b461 100644
--- a/arch/sparc/kernel/sun4d_irq.c
+++ b/arch/sparc/kernel/sun4d_irq.c
@@ -183,7 +183,7 @@ void sun4d_free_irq(unsigned int irq, void *dev_id)
 		goto out_unlock;
 	}
 	
-	if (action && tmp)
+	if (tmp)
 		tmp->next = action->next;
 	else
 		*actionp = action->next;

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

* Re: [PATCH 3/11] arch/sparc/kernel: Eliminate what looks like a NULL pointer dereference
  2010-05-27 12:32 [PATCH 3/11] arch/sparc/kernel: Eliminate what looks like a NULL pointer dereference Julia Lawall
@ 2010-06-04 23:17 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-06-04 23:17 UTC (permalink / raw)
  To: julia
  Cc: grant.likely, sparclinux, linux-kernel, devicetree-discuss,
	kernel-janitors

From: Julia Lawall <julia@diku.dk>
Date: Thu, 27 May 2010 14:32:45 +0200 (CEST)

> From: Julia Lawall <julia@diku.dk>
> 
> At the point of the test, action cannot be NULL, as it has been dereferenced
> in the code just above.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
 ...
> Signed-off-by: Julia Lawall <julia@diku.dk>

Applied, thanks Julia.

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

end of thread, other threads:[~2010-06-04 23:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27 12:32 [PATCH 3/11] arch/sparc/kernel: Eliminate what looks like a NULL pointer dereference Julia Lawall
2010-06-04 23:17 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox