Author: Julia Lawall <julia@diku.dk> The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) – 1) / (d)) but is perhaps more readable. In the case of the file drivers/atm/eni.c, I am a little bit suspicious of the -1 at the end of the affected expression. Please check that that is what is wanted. An …
Category: Coccinelle
Sep 23 2008
drivers/isdn/capi/kcapi.c: Adjust error handling code involving capi_ctr_put
Author: Julia Lawall <julia@diku.dk> After calling capi_ctr_get, error handling code should call capi_ctr_put. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r@ expression x,E; statement S; position p1,p2,p3; @@ ( if ((x = capi_ctr_get@p1(…)) == NULL || …) S | x = capi_ctr_get@p1(…) … when != x if (x == NULL …
Sep 23 2008
drivers/block: Use DIV_ROUND_UP
Author: Julia Lawall <julia@diku.dk> The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) – 1) / (d)) but is perhaps more readable. An extract of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @haskernel@ @@ #include @depends on haskernel@ expression n,d; @@ ( – (n + d – 1) / …
Sep 10 2008
arch/x86/kernel/kdebugfs.c: introduce missing kfree
Author: Julia Lawall <julia@diku.dk> Error handling code following a kmalloc should free the allocated data. Note that at the point of the change, node has not yet been stored in d, so it is not affected by the existing cleanup code. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ …
Sep 03 2008
net/xfrm: Use an IS_ERR test rather than a NULL test
Author: Julien Brunel <brunel@diku.dk> In case of error, the function xfrm_bundle_create returns an ERR pointer, but never returns a NULL pointer. So a NULL test that comes after an IS_ERR test should be deleted. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @match_bad_null_test@ expression x, E; statement S1,S2; @@ x = …
Sep 01 2008
USB: drivers/usb/misc: Use an IS_ERR test rather than a NULL test
Author: Julien Brunel <brunel@diku.dk> In case of error, the function backlight_device_register returns an ERR pointer, but never returns a NULL pointer. So a NULL test that may come after a call to this function should be strengthened by an IS_ERR test. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @match_bad_null_test@ expression …
Sep 01 2008
GFS2: Use an IS_ERR test rather than a NULL test
Author: Julien Brunel <brunel@diku.dk> In case of error, the function gfs2_inode_lookup returns an ERR pointer, but never returns a NULL pointer. So a NULL test that necessarily comes after an IS_ERR test should be deleted, and a NULL test that may come after a call to this function should be strengthened by an IS_ERR test. …
Aug 29 2008
UBIFS: use an IS_ERR test rather than a NULL test
Author: Julien Brunel <brunel@diku.dk> In case of error, the function kthread_create returns an ERR pointer, but never returns a NULL pointer. So a NULL test that comes before an IS_ERR test should be deleted. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @match_bad_null_test@ expression x, E; statement S1,S2; @@ x = …
Aug 28 2008
Blackfin arch: sram: use ‘unsigned long’ for irqflags
Author: Vegard Nossum <vegard.nossum@gmail.com> Using just ‘unsigned’ will make flags an unsigned int. While this is arguably not an error on blackfin where sizeof(int) == sizeof(long), the patch is still justified on the grounds of principle. The patch was generated using the Coccinelle semantic patch framework. Cc: Julia Lawall Cc: Alexey Dobriyan Signed-off-by: Vegard Nossum …
Aug 23 2008
net/mac80211/mesh.c: correct the argument to __mesh_table_free
Author: Julia Lawall <julia@diku.dk> In the function mesh_table_grow, it is the new table not the argument table that should be freed if the function fails (cf commit bd9b448f4c0a514559bdae4ca18ca3e8cd999c6d) The semantic match that detects this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; expression E,f; position p1,p2,p3; identifier l; statement S; @@ x …