netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 8/11] drivers/net: Correct NULL test
@ 2010-02-06  8:44 Julia Lawall
  2010-02-09  6:44 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2010-02-06  8:44 UTC (permalink / raw)
  To: Paul Gortmaker, netdev, 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>

---
 drivers/net/ax88796.c               |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 62d9c9c..1dd4403 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -921,7 +921,7 @@ static int ax_probe(struct platform_device *pdev)
  		size = (res->end - res->start) + 1;
 
 		ax->mem2 = request_mem_region(res->start, size, pdev->name);
-		if (ax->mem == NULL) {
+		if (ax->mem2 == NULL) {
 			dev_err(&pdev->dev, "cannot reserve registers\n");
 			ret = -ENXIO;
 			goto exit_mem1;

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

* Re: [PATCH 8/11] drivers/net: Correct NULL test
  2010-02-06  8:44 [PATCH 8/11] drivers/net: Correct NULL test Julia Lawall
@ 2010-02-09  6:44 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-02-09  6:44 UTC (permalink / raw)
  To: julia; +Cc: p_gortmaker, netdev, linux-kernel, kernel-janitors

From: Julia Lawall <julia@diku.dk>
Date: Sat, 6 Feb 2010 09:44:15 +0100 (CET)

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

Hehe, every time I read that tool name I hear "Coco Channel" :-)

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

Applied, thanks!

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

end of thread, other threads:[~2010-02-09  6:44 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:44 [PATCH 8/11] drivers/net: Correct NULL test Julia Lawall
2010-02-09  6:44 ` David Miller

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