Author: Julia Lawall <julia@diku.dk> Error handling code following a kmalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if (x == NULL) S f1 …
Category: Linux
Aug 31 2009
Staging: rtl8192e: Drop unnecessary NULL test
Author: Julia Lawall <julia@diku.dk> The result of container_of should not be NULL. In particular, in this case the argument to the enclosing function has passed though INIT_WORK, which dereferences it, implying that its container cannot be NULL. A simplified version of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ identifier …
Aug 23 2009
[S390] drivers/s390: put NULL test before dereference
Author: Julia Lawall <julia@diku.dk> If the NULL test on block is needed, it should be before the dereference of the base field. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ expression E1,E2; identifier fld; statement S1,S2; @@ E1 = E2->fld; ( if (E1 == NULL) S1 else S2 | *if …
Aug 15 2009
staging: Make some structures static
Author: Julia Lawall <julia@diku.dk> This was done using a semantic patch (http://coccinelle.lip6.fr/) that checks that the declaration is not inside a function definition, that the defined variable is not exported using EXPORTED_SYMBOL, etc, and that the defined variable does not occur in any other file. If these conditions hold, static is added before the declaration. …
Aug 12 2009
USB: isp1362: Correct use of ! and &
Author: Julia Lawall <julia@diku.dk> Correct priority problem in the use of ! and &. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression E; constant C; @@ – !E & C + !(E & C) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/usb/host/isp1362-hcd.c | 12 ++++++++—- 1 file changed, …
Aug 09 2009
VIDEO: Correct use of request_region/request_mem_region
Author: Julia Lawall <julia@diku.dk> request_region should be used with release_region, not request_mem_region. Geert Uytterhoeven pointed out that in the case of drivers/video/gbefb.c, the problem is actually the other way around; request_mem_region should be used instead of request_region. The semantic patch that finds/fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @r1@ expression start; @@ request_region(start,…) @b1@ …
Aug 09 2009
VIDEO: Correct use of request_region/request_mem_region
Author: Julia Lawall <julia@diku.dk> request_region should be used with release_region, not request_mem_region. Geert Uytterhoeven pointed out that in the case of drivers/video/gbefb.c, the problem is actually the other way around; request_mem_region should be used instead of request_region. The semantic patch that finds/fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @r1@ expression start; @@ request_region(start,…) @b1@ …
Aug 09 2009
drivers/net: Correct use of request_region/request_mem_region
Author: Julia Lawall <julia@diku.dk> request_mem_region should be used with release_mem_region, not request_region. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @r2@ expression start; @@ request_mem_region(start,…) @b2@ expression r2.start; @@ request_region(start,…) @depends on !b2@ expression r2.start; expression E; @@ – release_region + release_mem_region (start,E) // Signed-off-by: Julia Lawall Signed-off-by: David S. Miller …
Aug 08 2009
HID: fix memory leak on error patch in debug code
Author: Julia Lawall <julia@diku.dk> Error handling code following a kzalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if (x == NULL) S f1 …
Aug 07 2009
Btrfs: correct error-handling zlib error handling
Author: Julia Lawall <julia@diku.dk> find_zlib_workspace returns an ERR_PTR value in an error case instead of NULL. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @match exists@ expression x, E; statement S1, S2; @@ x = find_zlib_workspace(…) … when != x = E ( * if (x == …