Catégorie : Coccinelle

powerpc/pmac/windfarm: Correct potential double free

Author: Julia Lawall <julia@diku.dk> The conditionals were testing different values, but then all freeing the same one, which could result in a double free. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression x,e; identifier f; iterator I; statement S; @@ *kfree(x); … when != &x …

Lire la suite

arch/sparc/kernel: Use set_cpus_allowed_ptr

Author: Julia Lawall <julia@diku.dk> Use set_cpus_allowed_ptr rather than set_cpus_allowed. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression E1,E2; @@ – set_cpus_allowed(E1, cpumask_of_cpu(E2)) + set_cpus_allowed_ptr(E1, cpumask_of(E2)) @@ expression E; identifier I; @@ – set_cpus_allowed(E, I) + set_cpus_allowed_ptr(E, &I) // Signed-off-by: Julia Lawall Signed-off-by: David S. Miller — arch/sparc/kernel/sysfs.c | 4 …

Lire la suite

arch/sh/kernel: Use set_cpus_allowed_ptr

Author: Julia Lawall <julia@diku.dk> Use set_cpus_allowed_ptr rather than set_cpus_allowed. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression E1,E2; @@ – set_cpus_allowed(E1, cpumask_of_cpu(E2)) + set_cpus_allowed_ptr(E1, cpumask_of(E2)) @@ expression E; identifier I; @@ – set_cpus_allowed(E, I) + set_cpus_allowed_ptr(E, &I) // Signed-off-by: Julia Lawall Signed-off-by: Paul Mundt — arch/sh/kernel/cpufreq.c | 4 ++– …

Lire la suite

MIPS: Use set_cpus_allowed_ptr

Author: Julia Lawall <julia@diku.dk> From: Julia Lawall Use set_cpus_allowed_ptr rather than set_cpus_allowed. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression E1,E2; @@ – set_cpus_allowed(E1, cpumask_of_cpu(E2)) + set_cpus_allowed_ptr(E1, cpumask_of(E2)) @@ expression E; identifier I; @@ – set_cpus_allowed(E, I) + set_cpus_allowed_ptr(E, &I) // Signed-off-by: Julia Lawall To: peterz@infradead.org To: mingo@elte.hu To: …

Lire la suite

powerpc: Use set_cpus_allowed_ptr

Author: Julia Lawall <julia@diku.dk> Use set_cpus_allowed_ptr rather than set_cpus_allowed. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression E1,E2; @@ – set_cpus_allowed(E1, cpumask_of_cpu(E2)) + set_cpus_allowed_ptr(E1, cpumask_of(E2)) @@ expression E; identifier I; @@ – set_cpus_allowed(E, I) + set_cpus_allowed_ptr(E, &I) // Signed-off-by: Julia Lawall Signed-off-by: Benjamin Herrenschmidt — arch/powerpc/kernel/smp.c | 4 ++– …

Lire la suite

[ARM] pxa: avoid NULL dereferencing in error handling of ssp.c

Author: Julia Lawall <julia@diku.dk> The assignments of res to the results of the two calls to platform_get_resource make it impossible to use res in the error handling code in the arguments to release_mem_region. The semantic match that finds the former problem is as follows: (http://coccinelle.lip6.fr/) // @r exists@ expression E, E1; identifier f; statement S1,S3; …

Lire la suite

init dynamic bin_attribute structures

Author: Wolfram Sang <w.sang@pengutronix.de> Commit 6992f5334995af474c2b58d010d08bc597f0f2fe (« sysfs: Use one lockdep class per sysfs attribute. ») introduced this requirement. First, at25 was fixed manually. Then, other occurences were found with coccinelle and the following semantic patch. Results were reviewed and fixed up: @ init @ identifier struct_name, bin; @@ struct struct_name { … struct bin_attribute bin; … …

Lire la suite

V4L/DVB: drivers/media/video: move dereference after NULL test

Author: Julia Lawall <julia@diku.dk> In quickcam_messenger.c, if the NULL test on uvd is needed, then the dereference should be after the NULL test. In vpif_display.c, std_info is initialized to the address of a structure field. This seems unlikely to be NULL. Test std_info->stdid instead. In saa7134-alsa.c, the function is only called from one place, where …

Lire la suite

[SCSI] bfa: eliminate useless code

Author: Julia Lawall <julia@diku.dk> The variable bfa_itnim is initialized twice to the same (side effect-free) expression. Drop one initialization. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(…) … when != x ( x = f(…,,…) | * x = f(…) …

Lire la suite

drivers/char/mmtimer.c: eliminate useless code

Author: Julia Lawall <julia@diku.dk> The variable x is initialized twice to the same (side effect-free) expression. Drop one initialization. A simplified version of the semantic match that finds this problem is: (http://coccinelle.lip6.fr/) // @forall@ idexpression *x; identifier f!=ERR_PTR; @@ x = f(…) … when != x ( x = f(…,,…) | * x = f(…) …

Lire la suite