Category: Linux

drivers/net/wireless: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kzalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if (x == NULL) S f1 …

Continue reading

powerpc/qe: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kzalloc should free the allocated data. The semantic match that finds the problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @r exists@ local idexpression x; statement S; expression E; identifier f,f1,l; position p1,p2; expression *ptr != NULL; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); … if (x == NULL) S f1 …

Continue reading

fujitsu-laptop: Correct redundant test

Author: Julia Lawall <julia@diku.dk> device and acpi_driver_data(device) were tested just a few lines above. 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 forall return …; } .. when != \(x=E\|x–\|x++\|–x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\) …

Continue reading

ALSA: sound/aoa: Add kmalloc NULL tests

Author: Julia Lawall <julia@diku.dk> Check that the result of kzalloc is not NULL before a dereference. 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

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