Author: Julia Lawall <julia@diku.dk> In this code, 0 is returned on failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @a@ identifier alloc; identifier ret; constant C; expression x; @@ x = alloc(…); if (x == NULL) …
Catégorie : Linux
Oct 18 2010
drivers/net/ax88796.c: Return error code in failure
Author: Julia Lawall <julia@diku.dk> In this code, 0 is returned on failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @a@ identifier alloc; identifier ret; constant C; expression x; @@ x = alloc(…); if (x == NULL) …
Oct 17 2010
jffs2: use kmemdup
Author: Julia Lawall <julia@diku.dk> Convert a sequence of kmalloc and memcpy to use kmemdup. The semantic patch that performs this transformation is: (http://coccinelle.lip6.fr/) // @@ expression a,flag,len; expression arg,e1,e2; statement S; @@ a = – \(kmalloc\|kzalloc\)(len,flag) + kmemdup(arg,len,flag) – memcpy(a,arg,len+1); // Signed-off-by: Julia Lawall Signed-off-by: Artem Bityutskiy Signed-off-by: David Woodhouse — fs/jffs2/dir.c | 3 +– …
Oct 17 2010
fs/ceph/xattr.c: Use kmemdup
Author: Julia Lawall <julia@diku.dk> Convert a sequence of kmalloc and memcpy to use kmemdup. The semantic patch that performs this transformation is: (http://coccinelle.lip6.fr/) // @@ expression a,flag,len; expression arg,e1,e2; statement S; @@ a = – \(kmalloc\|kzalloc\)(len,flag) + kmemdup(arg,len,flag) – memcpy(a,arg,len+1); // Signed-off-by: Julia Lawall Signed-off-by: Sage Weil — fs/ceph/xattr.c | 3 +– 1 file changed, …
Oct 15 2010
staging: tidspbridge: Clean up error-handling code
Author: Julia Lawall <julia@diku.dk> In the first hunk, 0 is returned on memory allocation failure, even though other failures return -ENOMEM or other similar values. In the second hunk, there was error handling code that returned without freeing psz_path_name. A simplified version of the semantic match that finds the first problem is as follows: (http://coccinelle.lip6.fr/) …
Oct 15 2010
SERIAL: ioc3_serial: Return -ENOMEM on memory allocation failure
Author: Julia Lawall <julia@diku.dk> In this code, 0 is returned on memory allocation failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression ret; expression x,e1,e2,e3; @@ ret = 0 … when != ret = e1 …
Oct 15 2010
drivers/net/wireless/p54/eeprom.c: Return -ENOMEM on memory allocation failure
Author: Julia Lawall <julia@diku.dk> In this code, 0 is returned on memory allocation failure, even though other failures return -ENOMEM or other similar values. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression ret; expression x,e1,e2,e3; @@ ret = 0 … when != ret = e1 …
Oct 02 2010
drivers/gpu/drm/i915/i915_gem.c: Add missing error handling code
Author: Julia Lawall <julia@diku.dk> Extend the error handling code with operations found in other nearby error handling code A simplified version of the sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ @r@ statement S1,S2,S3; constant C1,C2,C3; @@ *if (…) {… S1 return -C1;} … *if (…) {… when != S1 …
Oct 02 2010
[media] drivers/media/dvb/ttpci/av7110_av.c: Add missing error handling code
Author: Julia Lawall <julia@diku.dk> Extend the error handling code with operations found in other nearby error handling code. A simplified version of the sematic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ @r@ statement S1,S2,S3; constant C1,C2,C3; @@ *if (…) {… S1 return -C1;} … *if (…) {… when != S1 …
Oct 02 2010
drivers/atm/idt77252.c: Remove unnecessary error check
Author: Julia Lawall <julia@diku.dk> This code does not call deinit_card(card); in an error case, as done in other error-handling code in the same function. But actually, the called function init_sram can only return 0, so there is no need for the error check at all. init_sram is also given a void return type, and its …