Category: Coccinelle

IB/ehca: Drop unnecessary NULL test

Author: Julia Lawall <julia@diku.dk> list_for_each_entry binds its first argument to a non-null value, and thus any null test on the value of that argument is superfluous. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator I; expression x; statement S,S1,S2; @@ I(x,…) { } // Signed-off-by: Julia Lawall Acked-by: Alexander …

Continue reading

staging: Drop unnecessary null test

Author: Julia Lawall <julia@diku.dk> list_for_each_entry binds its first argument to a non-null value, and thus any null test on the value of that argument is superfluous. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator I; expression x; statement S; @@ I(x,…) { } // Signed-off-by: Julia Lawall Signed-off-by: Greg …

Continue reading

fs/dlm: Drop unnecessary null test

Author: Julia Lawall <julia@diku.dk> hlist_for_each_entry binds its first argument to a non-null value, and thus any null test on the value of that argument is superfluous. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator I; expression x,E,E1,E2; statement S,S1,S2; @@ I(x,…) { } // Signed-off-by: Julia Lawall Signed-off-by: David …

Continue reading

powerpc/pci: Drop unnecessary null test

Author: Julia Lawall <julia@diku.dk> list_for_each_entry binds its first argument to a non-null value, and thus any null test on the value of that argument is superfluous. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator I; expression x,E,E1,E2; statement S,S1,S2; @@ I(x,…) { } // Signed-off-by: Julia Lawall Signed-off-by: Benjamin …

Continue reading

powerpc/powermac: Drop unnecessary null test

Author: Julia Lawall <julia@diku.dk> for_each_node_by_name binds its first argument to a non-null value, and thus any null test on the value of that argument is superfluous. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator I; expression x,E; @@ I(x,…) { } // Signed-off-by: Julia Lawall Signed-off-by: Benjamin Herrenschmidt — …

Continue reading

powerpc/powermac: Drop unnecessary of_node_put

Author: Julia Lawall <julia@diku.dk> for_each_node_by_name only exits when its first argument is NULL, and a subsequent call to of_node_put on that argument is unnecessary. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator name for_each_node_by_name; expression np,E; identifier l; @@ for_each_node_by_name(np,…) { … when != break; when != goto l; …

Continue reading

arch/sparc/mm: Use GFP_KERNEL

Author: Julia Lawall <julia@diku.dk> GFP_ATOMIC is not needed here, as evidenced by the other two uses of GFP_KERNEL in the same function. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier f; @@ *f(…,GFP_ATOMIC,…) … when != spin_unlock(…) when != read_unlock(…) when != write_unlock(…) when != read_unlock_irq(…) when != write_unlock_irq(…) …

Continue reading

[SCSI] pm8001: introduce missing kfree

Author: Julia Lawall <julia@diku.dk> Error handling code following a kmalloc 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; expression E; identifier f,f1; position p1,p2; @@ x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(…); f1 = E | (x->f1 == NULL || …) | f(…,x->f1,…) ) …> …

Continue reading

net/rose: Use GFP_ATOMIC

Author: Julia Lawall <julia@diku.dk> The other calls to kmalloc in the same function use GFP_ATOMIC, and indeed two locks are held within the body of the function. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ identifier f; @@ *f(…,GFP_ATOMIC,…) … when != spin_unlock(…) when != read_unlock(…) when != write_unlock(…) when …

Continue reading

SA1111: Eliminate use after free

Author: Julia Lawall <julia@diku.dk> __sa1111_remove always frees its argument, so the subsequent reference to sachip->saved_state represents a use after free. __sa1111_remove does not appear to use the saved_state field, so the patch simply frees it first. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression E,E2; …

Continue reading