Author: Julia Lawall <julia@diku.dk> Sizeof a pointer-typed expression returns the size of the pointer, not that of the pointed data. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *e; type T; identifier f; @@ f(…,(T)e,…, -sizeof(e) +sizeof(*e) ,…) // Signed-off-by: Julia Lawall Signed-off-by: James Bottomley — drivers/scsi/mpt2sas/mpt2sas_transport.c | 2 …
Category: Linux
Sep 16 2011
drivers/staging/mei/interface.c: take size of pointed value, not pointer
Author: Julia Lawall <julia@diku.dk> Sizeof a pointer-typed expression returns the size of the pointer, not that of the pointed data. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *e; type T; identifier f; @@ f(…,(T)e,…, -sizeof(e) +sizeof(*e) ,…) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/staging/mei/interface.c | 4 …
Aug 26 2011
drivers/char/msm_smd_pkt.c: don’t use IS_ERR()
Author: Thomas Meyer <thomas@m3y3r.de> The various basic memory allocation function return NULL, not an ERR_PTR. The semantic patch that makes this change is available in scripts/coccinelle/null/eno.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Thomas Meyer Cc: Niranjana Vishwanathapura Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds — drivers/char/msm_smd_pkt.c | 5 ++— 1 file changed, …
Aug 24 2011
[S390] drivers/s390/block/dasd_ioctl.c: add missing kfree
Author: Julia Lawall <julia@diku.dk> Data is only used to temporarily hold information to be copied to the user level, so it should be freed before leaving the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @exists@ local idexpression x; statement S,S1; expression E; identifier fl; expression …
Aug 22 2011
drivers/net/wireless/mwifiex/scan.c: test the just-initialized value
Author: Julia Lawall <julia@diku.dk> Test the just-initialized value rather than some other one. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST}; statement S; @@ x = f(…); ( if (\(x == NULL\|IS_ERR(x)\)) S | *if (\(y == NULL\|IS_ERR(y)\)) { … when != x return …; } ) // …
Aug 22 2011
drivers/usb/host/ohci-omap3.c: test the just-initialized value
Author: Julia Lawall <julia@diku.dk> Test the just-initialized value rather than some other one. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST}; statement S; @@ x = f(…); ( if (\(x == NULL\|IS_ERR(x)\)) S | *if (\(y == NULL\|IS_ERR(y)\)) { … when != x return …; } ) // …
Aug 22 2011
drivers/staging/usbip/userspace/libsrc/vhci_driver.c: test the just-initialized value
Author: Julia Lawall <julia@diku.dk> Test the just-initialized value rather than some other one. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x,y,f!={PTR_ERR,ERR_PTR,ERR_CAST}; statement S; @@ x = f(…); ( if (\(x == NULL\|IS_ERR(x)\)) S | *if (\(y == NULL\|IS_ERR(y)\)) { … when != x return …; } ) // …
Aug 21 2011
sound/soc/mxs/mxs-saif.c: add missing kfree
Author: Julia Lawall <julia@diku.dk> Move the test on pdev->id before the kzalloc to avoid requiring kfree when the test fails. This fix was suggested by Wolfram Sang. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier x; expression E1!=0,E2,E3,E4; statement S; iterator I; @@ ( if …
Aug 21 2011
powerpc/powermac: Add missing of_node_put
Author: Julia Lawall <julia@diku.dk> np is initialized to the result of calling a function that calls of_node_get, so of_node_put should be called before the pointer is dropped. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e,e1,e2; @@ * e = \(of_find_node_by_type\|of_find_node_by_name\)(…) … when != of_node_put(e) when != true e …
Aug 21 2011
powerpc/cell/iommu: Add missing of_node_put
Author: Julia Lawall <julia@diku.dk> np is initialized to the result of calling a function that calls of_node_get, so of_node_put should be called before the pointer is dropped. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e,e1,e2; @@ * e = \(of_find_node_by_type\|of_find_node_by_name\)(…) … when != of_node_put(e) when != true e …