Category: Coccinelle

net/netlabel: Add kmalloc NULL tests

Author: Julia Lawall <julia@diku.dk> The test on map4 should be a test on map6. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression *x; identifier f; constant char *C; @@ x = \(kmalloc\|kcalloc\|kzalloc\)(…); … when != x == NULL when != x != NULL when != (x || …) ( …

Continue reading

Staging: hv: Remove typedef STORVSC_REQUEST and PSTORVSC_REQUEST

Author: Nicolas Palix <npalix@diku.dk> typedef STORVSC_REQUEST and PSTORVSC_REQUEST are removed and their usages are replace by the use of struct hv_storvsc_request and struct hv_storvsc_request * respectively. Here is the semantic patch generated to perform this transformation: (http://coccinelle.lip6.fr/) // @rm_STORVSC_REQUEST@ @@ -typedef struct _STORVSC_REQUEST +struct hv_storvsc_request {…} -STORVSC_REQUEST ; @rm_PSTORVSC_REQUEST@ @@ -typedef struct _STORVSC_REQUEST *PSTORVSC_REQUEST; +struct …

Continue reading

Staging: hv: Remove typedef NETVSC_PACKET and PNETVSC_PACKET

Author: Nicolas Palix <npalix@diku.dk> typedef NETVSC_PACKET and PNETVSC_PACKET are removed and their usages are replace by the use of struct hv_netvsc_packet and struct hv_netvsc_packet * respectively. Here is the semantic patch generated to perform this transformation: (http://coccinelle.lip6.fr/) // @rm_NETVSC_PACKET@ @@ -typedef struct _NETVSC_PACKET +struct hv_netvsc_packet {…} -NETVSC_PACKET ; @rm_PNETVSC_PACKET@ @@ -typedef struct _NETVSC_PACKET *PNETVSC_PACKET; +struct …

Continue reading

Staging: hv: Remove typedef DRIVER_OBJECT and PDRIVER_OBJECT

Author: Nicolas Palix <npalix@diku.dk> typedef DRIVER_OBJECT and PDRIVER_OBJECT are removed and their usages are replace by the use of struct hv_driver and struct hv_driver * respectively. Here is the semantic patch generated to perform this transformation: (http://coccinelle.lip6.fr/) // @rm_DRIVER_OBJECT@ @@ -typedef struct _DRIVER_OBJECT +struct hv_driver {…} -DRIVER_OBJECT ; @rm_PDRIVER_OBJECT@ @@ -typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT; +struct …

Continue reading

KVM: correct error-handling code

Author: Julia Lawall <julia@diku.dk> This code is not executed before file has been initialized to the result of calling eventfd_fget. This function returns an ERR_PTR value in an error case instead of NULL. Thus the test that file is not NULL is always true. A simplified version of the semantic match that finds this problem …

Continue reading

Staging: dst: correct error-handling code

Author: Julia Lawall <julia@diku.dk> dst_state_alloc returns an ERR_PTR value in an error case instead of NULL. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @match exists@ expression x, E; statement S1, S2; @@ x = dst_state_alloc(…) … when != x = E ( * if (x == …

Continue reading

Staging: hv: Transform PDEVICE_OBJECT and DEVICE_OBJECT typedefs into their corresponding structs

Author: Nicolas Palix <npalix@diku.dk> Remove typedef DEVICE_OBJECT and use a struct named hv_device instead. Remove typedef PDEVICE_OBJECT which aliases a pointer and use struct hv_device * instead. Here is the semantic patch to perform this transformation: (http://coccinelle.lip6.fr/) // @rm_PDEVICE_OBJECT@ @@ -typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT; @rm_DEVICE_OBJECT@ @@ -typedef struct _DEVICE_OBJECT +struct hv_device {…} -DEVICE_OBJECT ; @fixtypedef_PDEVICE_OBJECT@ …

Continue reading

Staging: Correct use of ! and &

Author: Julia Lawall <julia@diku.dk> Correct priority problem in the use of ! and &. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression E; constant C; @@ – !E & C + !(E & C) // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/staging/rt3090/sta_ioctl.c | 6 ++—- drivers/staging/vt6656/iwctl.c | 3 …

Continue reading

drivers/atm: Correct redundant test

Author: Julia Lawall <julia@diku.dk> str has already been tested. It seems that this test should be on the recently returned value snr. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; expression E; @@ if (x == NULL || …) { … when …

Continue reading

Btrfs: Correct redundant test in add_inode_ref

Author: Julia Lawall <julia@diku.dk> dir has already been tested. It seems that this test should be on the recently returned value inode. A simplified version of the semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) Signed-off-by: Julia Lawall Signed-off-by: Chris Mason — fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) …

Continue reading

BtrLinux
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.