Author: Julia Lawall <julia@diku.dk> Convert array index from the loop bound to the loop index. A simplified version of the semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2,ar; @@ for(e1 = 0; e1 < e2; e1++) { } // Signed-off-by: Julia Lawall Signed-off-by: David S. Miller --- drivers/net/niu.c | …
Category: Linux
Jul 28 2011
net: adjust array index
Author: Julia Lawall <julia@diku.dk> Convert array index from the loop bound to the loop index. A simplified version of the semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2,ar; @@ for(e1 = 0; e1 < e2; e1++) { } // Signed-off-by: Julia Lawall Signed-off-by: David S. Miller --- net/ipv4/igmp.c | …
Jul 12 2011
[SCSI] ipr: reorder error handling code to include iounmap
Author: Julia Lawall <julia@diku.dk> The out_msi_disable label should be before cleanup_nomem to additionally benefit from the call to iounmap. Subsequent gotos are adjusted to go to out_msi_disable instead of cleanup_nomem, which now follows it. This is safe because pci_disable_msi does nothing if pci_enable_msi was not called. A simplified version of the semantic match that finds …
Jul 09 2011
drivers/staging/hv/blkvsc_drv.c: eliminate NULL pointer dereference
Author: Julia Lawall <julia@diku.dk> In this code, blkvsc_req is allocated in the cache blkdev->request_pool, but freed in the first case to the cache blkvsc_req->dev->request_pool. blkvsc_req->dev is subsequently initialized to blkdev, making these the same at the second call to kmem_cache_free. But at the point of the first call, blkvsc_req->dev is NULL. The second call is …
Jul 09 2011
fs/ocfs2/dlm/dlmlock.c: free kmem_cache_zalloc’d data using kmem_cache_free
Author: Julia Lawall <julia@diku.dk> Memory allocated using kmem_cache_zalloc should be freed using kmem_cache_free, not kfree. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,e,e1,e2; @@ x = kmem_cache_zalloc(e1,e2) … when != x = e ?-kfree(x) +kmem_cache_free(e1,x) // Signed-off-by: Julia Lawall Signed-off-by: Joel Becker — fs/ocfs2/dlm/dlmlock.c | 2 +- 1 …
Jul 04 2011
drivers/video/msm/mdp.c: adjust error handling code
Author: Julia Lawall <julia@diku.dk> Use the error handling code at the end of the function, rather than returning directly. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x; @@ kfree(x) @@ identifier r.x; expression E1!=0,E2,E3,E4; statement S; @@ ( if () S | if (…) { … when != …
Jul 04 2011
arch/arm/mach-omap2/clock.c: add missing clk_put
Author: Julia Lawall <julia@diku.dk> Add missing call to clk_put. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ expression e1,e2; statement S; @@ e1 = clk_get@p1(…); … when != e1 = e2 when != clk_put(e1) when any if (…) { … when != clk_put(e1) when != …
Jun 16 2011
drivers/net: Remove casts of void *
Author: Joe Perches <joe@perches.com> Unnecessary casts of void * clutter the code. These are the remainder casts after several specific patches to remove netdev_priv and dev_priv. Done via coccinelle script (and a little editing): $ cat cast_void_pointer.cocci @@ type T; T *pt; void *pv; @@ – pt = (T *)pv; + pt = pv; Signed-off-by: …
Jun 16 2011
m68k/math-emu: Remove unnecessary code
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu> Remove unnecessary code that matches this coccinelle pattern if (…) return ret; return ret; Signed-off-by: Greg Dietsche Signed-off-by: Geert Uytterhoeven — arch/m68k/math-emu/fp_log.c | 3 — 1 file changed, 3 deletions(-) diff –git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c index 367ecee..3384a52 100644 — a/arch/m68k/math-emu/fp_log.c +++ b/arch/m68k/math-emu/fp_log.c @@ -105,9 +105,6 @@ fp_fetoxm1(struct fp_ext *dest, struct fp_ext …
Jun 16 2011
ata: remove unnecessary code
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu> Compile tested. remove unnecessary code that matches this coccinelle pattern if (…) return ret; return ret; Signed-off-by: Greg Dietsche Signed-off-by: Jeff Garzik — drivers/ata/pata_acpi.c | 8 +——- 1 file changed, 1 insertion(+), 7 deletions(-) diff –git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index 91949d9..54145ed 100644 — a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c @@ -195,8 +195,6 @@ static …