Author: Julia Lawall <julia@diku.dk> of_node_put is needed before discarding a value received from of_find_node_by_type, eg in error handling code. The semantic patch that makes the change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ struct device_node *n; struct device_node *n1; struct device_node *n2; statement S; identifier f1,f2; expression E1,E2; constant C; @@ n = of_find_node_by_type(…) … if …
Catégorie : Coccinelle
Jun 09 2008
[POWERPC] Add missing of_node_put in pseries/nvram.c
Author: Julia Lawall <julia@diku.dk> of_node_put is needed before discarding a value received from of_find_node_by_type, eg in error handling code. The semantic patch that makes the change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ struct device_node *n; struct device_node *n1; struct device_node *n2; statement S; identifier f1,f2; expression E1,E2; constant C; @@ n = of_find_node_by_type(…) … if …
May 29 2008
PCI: eliminate double kfree in intel-iommu initialization
Author: Julia Lawall <julia@diku.dk> The destination of goto error also does a kfree(g_iommus), so it is not correct to do one here. This was found using Coccinelle (http://www.emn.fr/x-info/coccinelle/). Signed-off-by: Julia Lawall Signed-off-by: Jesse Barnes — drivers/pci/intel-iommu.c | 1 – 1 file changed, 1 deletion(-) diff –git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 66c0fd2..4f05d91 100644 — a/drivers/pci/intel-iommu.c +++ …
May 13 2008
pppol2tp: Remove null pointer dereference.
Author: Julia Lawall <julia@diku.dk> If session is NULL, it is not possible to access its name field. So I have split apart the printing of the error message to drop the printing of the name field in this case. The macro PRINTK actually only evaluates its arguments starting with the third one if the bitwise …
May 13 2008
drivers/video/pnx4008: eliminate double free
Author: Julia Lawall <julia@diku.dk> The function framebuffer_release just calls kfree, so calling kfree subsequently on the same argument represents a double free. The comments with the definition of framebuffer_release in drivers/video/fbsysfs.c suggest that a more elaborate definition of this function is planned, such that the splitting up of framebuffer_release and kfree as done in the …
May 12 2008
drivers/net/fs_enet: remove null pointer dereference
Author: Julia Lawall <julia@diku.dk> The following code appears in the function fs_init_instance in the file drivers/net/fs_enet/fs_enet-main.c. if (fep->ops == NULL) { printk(KERN_ERR DRV_MODULE_NAME « : %s No matching ops found (%d).\n », ndev->name, fpi->fs_no); err = -EINVAL; goto err; } This code implies that at the point of err, fep->ops can be NULL, so an extra test …
May 01 2008
spi_s3c24xx signedness fix
Author: Matthew Wilcox <matthew@wil.cx> On Fri, Apr 18, 2008 at 09:08:55PM +0200, Julia Lawall wrote: > I found 63 occurrences of this problem with the following semantic match > (http://www.emn.fr/x-info/coccinelle/): > > @@ unsigned int i; @@ > > * i < 0 > Since this one’s always in the range 0-255, it could probably …
Apr 30 2008
drivers/char/ds1286.c: use time_before, time_before_eq, etc
Author: Julia Lawall <julia@diku.dk> The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values. A simplified version of the semantic patch making this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @ change_compare_np @ expression E; @@ ( – jiffies = E + time_after_eq(jiffies,E) | – jiffies < E + time_before(jiffies,E) …
Apr 29 2008
drivers/misc: elide a non-zero test on a result that is never 0
Author: Julia Lawall <julia@diku.dk> The function thermal_cooling_device_register always returns either a valid pointer or a value made with ERR_PTR, so a test for non-zero on the result will always succeed. The problem was found using the following semantic match. (http://www.emn.fr/x-info/coccinelle/) // @a@ expression E, E1; statement S,S1; position p; @@ E = thermal_cooling_device_register(…) … when …
Apr 29 2008
fs/affs/file.c: use BUG_ON
Author: Julia Lawall <julia@diku.dk> if (…) BUG(); should be replaced with BUG_ON(…) when the test has no side-effects to allow a definition of BUG_ON that drops the code completely. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @ disable unlikely @ expression E,f; @@ ( if () { BUG(); } | …