[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 …

Continue reading

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/) // …

Continue reading

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) …

Continue reading

[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 ( …

Continue reading

[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 …

Continue reading

[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 …

Continue reading

[XTENSA]: 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. The same problem occurs in some other drivers as well. This was found using the following semantic match. (http://www.emn.fr/x-info/coccinelle/) // @@ expression skb, e,e1; …

Continue reading

[UM]: 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. The same problem occurs in some other drivers as well. This was found using the following semantic match. (http://www.emn.fr/x-info/coccinelle/) // @@ expression skb, e,e1; …

Continue reading

drivers/serial/uartlite.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_compatible_node. 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_compatible_node; @@ T *d; … for_each_compatible_node(d,…) {… when != of_node_put(d) when != e = d ( …

Continue reading