x86/PCI: Convert release_resource to release_region/release_mem_region

Author: Julia Lawall <julia@diku.dk> Request_region should be used with release_region, not release_resource. The local variables region and region2 are dropped and the calls to release_resource are replaced with calls to release_region, using the first two arguments of the corresponding calls to request_region. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ …

Continue reading

drivers/char/pcmcia/ipwireless/main.c: Convert release_resource to release_region/release_mem_region

Author: Julia Lawall <julia@diku.dk> Request_region should be used with release_region, not release_resource. This patch contains a number of changes, related to calls to request_region, request_mem_region, and the associated error handling code. 1. For the call to request_region, the variable io_resource storing the result is dropped. The call to release_resource at the end of the function …

Continue reading

drivers/w1/masters/omap_hdq.c: add missing clk_put

Author: Julia Lawall <julia@diku.dk> This code makes two calls to clk_get, then test both return values and fails if either failed. The problem is that in the first inner if, where the first call to clk_get has failed, it don’t know if the second call has failed as well. So it don’t know whether clk_get …

Continue reading

mtd: ts5500_flash: avoid calling map_destroy on NULL

Author: Julia Lawall <julia@diku.dk> map_destroy dereferences its argument. The call is furthermore only reachable when this argument is NULL. Thus the call is dropped. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression *x; @@ *if (x == NULL) { … * map_destroy(x); … return …; } // Signed-off-by: Julia …

Continue reading

wl12xx: fix use after free

Author: Mathias Krause <minipli@googlemail.com> When DEBUG_SPI is included in the debug log level wl1271_spi_reset() will dump the already freed memory instead of the SPI buffer. This bug was spotted by the semantic patch tool coccinelle using the script found at scripts/coccinelle/free/kfree.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Mathias Krause Signed-off-by: John …

Continue reading

[media] V4L: omap1_camera: fix use after free

Author: Mathias Krause <minipli@googlemail.com> Even though clk_put() is a no-op on most architectures it is not for some ARM implementations. To not fail on those, release the clock timer before freeing the surrounding structure. This bug was spotted by the semantic patch tool coccinelle using the script found at scripts/coccinelle/free/kfree.cocci. More information about semantic patching …

Continue reading

net/wireless/nl80211.c: Avoid call to genlmsg_cancel

Author: Julia Lawall <julia@diku.dk> genlmsg_cancel subtracts some constants from its second argument before calling nlmsg_cancel. nlmsg_cancel then calls nlmsg_trim on the same arguments. nlmsg_trim tests for NULL before doing any computation, but a NULL second argument to genlmsg_cancel is no longer NULL due to the initial subtraction. Nothing else happens in this execution, so the …

Continue reading

staging: msm/lcdc.c: Convert IS_ERR result to PTR_ERR

Author: Julia Lawall <julia@diku.dk> This code elsewhere returns a negative constant to an indicate an error, while IS_ERR returns the result of a >= operation. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; @@ if (…) { … – return IS_ERR(x); + return PTR_ERR(x); } // Signed-off-by: Julia …

Continue reading

arch/arm/mach-omap2/dma.c: Convert IS_ERR result to PTR_ERR

Author: Julia Lawall <julia@diku.dk> This code elsewhere returns a negative constant to an indicate an error, while IS_ERR returns the result of a >= operation. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression x; @@ if (…) { … – return IS_ERR(x); + return PTR_ERR(x); } // Signed-off-by: Julia …

Continue reading

OMAP: PM: SmartReflex: Add missing IS_ERR test

Author: Julia Lawall <julia@diku.dk> Function _sr_lookup, defined in the same file, returns ERR_PTR not NULL in an error case. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier f; @@ f(…) { … return ERR_PTR(…); } @@ identifier r.f, fld; expression x; statement S1,S2; @@ x = f(…) … when …

Continue reading