Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 8/11] drivers/net: Correct NULL test

0 views
Skip to first unread message

Julia Lawall

unread,
Feb 6, 2010, 3:50:02 AM2/6/10
to
From: Julia Lawall <ju...@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 <ju...@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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

David Miller

unread,
Feb 9, 2010, 1:50:02 AM2/9/10
to
From: Julia Lawall <ju...@diku.dk>
Date: Sat, 6 Feb 2010 09:44:15 +0100 (CET)

> From: Julia Lawall <ju...@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 <ju...@diku.dk>

Applied, thanks!

0 new messages