Category: Coccinelle

Btrfs: Use ERR_CAST helpers

Author: Julia Lawall <julia@diku.dk> Use ERR_CAST(x) rather than ERR_PTR(PTR_ERR(x)). The former makes more clear what is the purpose of the operation, which otherwise looks like a no-op. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ type T; T x; identifier f; @@ T f (…) { } @@ expression x; …

Continue reading

Btrfs: use memdup_user helpers

Author: Julia Lawall <julia@diku.dk> Use memdup_user when user data is immediately copied into the allocated region. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression from,to,size,flag; position p; identifier l1,l2; @@ – to = \(kmalloc@p\|kzalloc@p\)(size,flag); + to = memdup_user(from,size); if ( – to==NULL + IS_ERR(to) || …) { } – …

Continue reading

drivers/video/gbefb.c: eliminate memory leak

Author: Julia Lawall <julia@diku.dk> This code is preceded by a call to framebuffer_alloc, which allocates memory, so this memory should be freed before leaving the function in an error case. out_release_framebuffer just frees the frame buffer and returns. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @r exists@ local …

Continue reading

drivers/video/matrox/matroxfb_maven.c: fix unsigned return type

Author: Julia Lawall <julia@diku.dk> The function has an unsigned return type, but returns a negative constant to indicate an error condition. The result of calling the function is only tested by comparison to 0, and thus unsigned is not needed and can be dropped from the return type. A sematic match that finds this problem …

Continue reading

drivers/ata/pata_octeon_cf.c: delete double assignment

Author: Julia Lawall <julia@diku.dk> Delete successive assignments to the same location. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = …; i = …; // Signed-off-by: Julia Lawall Signed-off-by: Jeff Garzik — drivers/ata/pata_octeon_cf.c | 2 — 1 file changed, 2 deletions(-)   …

Continue reading

sound/oss/sb_ess.c: delete double assignment

Author: Julia Lawall <julia@diku.dk> Delete successive assignments to the same location. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = …; i = …; // Signed-off-by: Julia Lawall Signed-off-by: Takashi Iwai — sound/oss/sb_ess.c | 1 – 1 file changed, 1 deletion(-)   …

Continue reading

drivers/platform/x86/thinkpad_acpi.c: delete double assignment

Author: Julia Lawall <julia@diku.dk> Delete successive assignments to the same location. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = …; i = …; // Signed-off-by: Julia Lawall Signed-off-by: Matthew Garrett — drivers/platform/x86/thinkpad_acpi.c | 1 – 1 file changed, 1 deletion(-)   …

Continue reading

drivers/staging/brcm80211/brcmfmac/dhd_linux.c: delete double assignment

Author: Julia Lawall <julia@diku.dk> Delete successive assignments to the same location. dhd_ops_virt contains a subset of the definitions of dhd_ops_pri. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = …; i = …; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/staging/brcm80211/brcmfmac/dhd_linux.c …

Continue reading

drivers/vhost/vhost.c: delete double assignment

Author: Julia Lawall <julia@diku.dk> Delete successive assignments to the same location. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = …; i = …; // Signed-off-by: Julia Lawall Signed-off-by: Michael S. Tsirkin — drivers/vhost/vhost.c | 1 – 1 file changed, 1 deletion(-) …

Continue reading

USB: gadget: amd5536udc.c: delete double assignment

Author: Julia Lawall <julia@diku.dk> Delete successive assignments to the same location. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression i; @@ *i = …; i = …; // Signed-off-by: Julia Lawall Acked-by: Thomas Dahlmann Signed-off-by: Greg Kroah-Hartman — drivers/usb/gadget/amd5536udc.c | 1 – 1 file changed, …

Continue reading