Author: Julia Lawall <julia@diku.dk> The file net/tipc/port.c takes a lock using the function tipc_port_lock and then releases the lock sometimes using tipc_port_unlock and sometimes using spin_unlock_bh(p_ptr->publ.lock). tipc_port_unlock simply does the spin_unlock_bh, but it seems cleaner to use it everywhere. The problem was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @@ struct port *p_ptr; @@ …
Category: Linux
Jan 08 2008
[BLUETOOTH]: Use sockfd_put()
Author: Julia Lawall <julia@diku.dk> The function sockfd_lookup uses fget on the value that is stored in the file field of the returned structure, so fput should ultimately be applied to this value. This can be done directly, but it seems better to use the specific macro sockfd_put, which does the same thing. The problem was …
Jan 07 2008
[ALSA] sound: 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) …
Jan 06 2008
[JFFS2] Add missing call to posix_acl_release
Author: Julia Lawall <julia@diku.dk> posix_acl_clone does a memory allocation and sets a reference count, so posix_acl_release is needed afterwards to free it. The problem was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @@ type T; identifier E; expression E1, E2; int ret; statement S; @@ T E; // Signed-off-by: Julia Lawall Acked-by: KaiGai Kohei …
Jan 02 2008
[X25]: Add missing x25_neigh_put
Author: Julia Lawall <julia@diku.dk> The function x25_get_neigh increments a reference count. At the point of the second goto out, the result of calling x25_get_neigh is only stored in a local variable, and thus no one outside the function will be able to decrease the reference count. Thus, x25_neigh_put should be called before the return in …
Jan 01 2008
V4L/DVB (7036): radio: Use video_device_release rather than kfree
Author: Julia Lawall <julia@diku.dk> The file drivers/media/video/videodev.c defines both video_device_alloc and video_device_release. These are essentially just kzmalloc and kfree, respectively, but it seems better to use video_device_release, as done in the other media files, rather than kfree, in case the implementation some day changes. The problem was found using the following semantic match. (http://www.emn.fr/x-info/coccinelle/) // …
Dec 18 2007
drivers/macintosh/via-pmu.c: Added a missing iounmap
Author: Julia Lawall <julia@diku.dk> The error handling code should undo the ioremap as well. The problem was detected using the following semantic match (http://www.emn.fr/x-info/coccinelle/) // @@ type T,T1,T2; identifier E; statement S; expression x1,x2; constant C; int ret; @@ T E; … * E = ioremap(…); if (E == NULL) S … when != iounmap(E) …
Dec 14 2007
[POWERPC] cell/cbe_regs.c: Add missing of_node_put
Author: Julia Lawall <julia@diku.dk> There should be an of_node_put when breaking out of a loop that iterates using for_each_node_by_type. This was detected and fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @@ identifier d; type T; expression e; iterator for_each_node_by_type; @@ T *d; … for_each_node_by_type(d,…) {… when != of_node_put(d) when != e = d ( …
Dec 14 2007
[POWERPC] arch/powerpc: Add missing of_node_put
Author: Julia Lawall <julia@diku.dk> There should be an of_node_put when breaking out of a loop that iterates over calls to of_find_all_nodes, as this function does an of_node_get on the value it returns. This was fixed using the following semantic patch. (http://www.emn.fr/x-info/coccinelle/) // @@ type T; identifier d; expression e; @@ T *d; … for (d …
Dec 11 2007
[S390]: Fix use of skb after netif_rx
Author: Julia Lawall <julia@diku.dk> Recently, Wang Chen submitted a patch (d30f53aeb31d453a5230f526bea592af07944564) to move a call to netif_rx(skb) after a subsequent reference to skb, because netif_rx may call kfree_skb on its argument. netif_rx_ni calls netif_rx, so the same problem occurs in the files below. I have left the updating of dev->last_rx after the calls to netif_rx_ni …