Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 2/11] arch/mips/sni: Correct NULL test
@ 2010-02-06  8:42 Julia Lawall
  2010-02-06  9:52 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2010-02-06  8:42 UTC (permalink / raw)
  To: Ralf Baechle, linux-mips, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>

Test the value that was just allocated rather than the previously tested one.

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

// <smpl>
@r@
expression *x;
expression e;
identifier l;
@@

if (x == NULL || ...) {
    ... when forall
    return ...; }
... when != goto l;
    when != x = e
    when != &x
*x == NULL
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
send
---
 arch/mips/sni/rm200.c               |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/sni/rm200.c b/arch/mips/sni/rm200.c
index 46f0069..31e2583 100644
--- a/arch/mips/sni/rm200.c
+++ b/arch/mips/sni/rm200.c
@@ -404,7 +404,7 @@ void __init sni_rm200_i8259_irqs(void)
 	if (!rm200_pic_master)
 		return;
 	rm200_pic_slave = ioremap_nocache(0x160000a0, 4);
-	if (!rm200_pic_master) {
+	if (!rm200_pic_slave) {
 		iounmap(rm200_pic_master);
 		return;
 	}

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

* Re: [PATCH 2/11] arch/mips/sni: Correct NULL test
  2010-02-06  8:42 [PATCH 2/11] arch/mips/sni: Correct NULL test Julia Lawall
@ 2010-02-06  9:52 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2010-02-06  9:52 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Ralf Baechle, linux-mips, linux-kernel, kernel-janitors

On Sat, Feb 06, 2010 at 09:42:16AM +0100, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
> 
> Test the value that was just allocated rather than the previously tested one.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r@
> expression *x;
> expression e;
> identifier l;
> @@
> 
> if (x == NULL || ...) {
>     ... when forall
>     return ...; }
> ... when != goto l;
>     when != x = e
>     when != &x
> *x == NULL
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> send
> ---
>  arch/mips/sni/rm200.c               |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/mips/sni/rm200.c b/arch/mips/sni/rm200.c
> index 46f0069..31e2583 100644
> --- a/arch/mips/sni/rm200.c
> +++ b/arch/mips/sni/rm200.c
> @@ -404,7 +404,7 @@ void __init sni_rm200_i8259_irqs(void)
>  	if (!rm200_pic_master)
>  		return;
>  	rm200_pic_slave = ioremap_nocache(0x160000a0, 4);
> -	if (!rm200_pic_master) {
> +	if (!rm200_pic_slave) {
>  		iounmap(rm200_pic_master);
>  		return;
>  	}

Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

Thanks for fixing.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2010-02-06  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-06  8:42 [PATCH 2/11] arch/mips/sni: Correct NULL test Julia Lawall
2010-02-06  9:52 ` Thomas Bogendoerfer

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