Catégorie : Coccinelle

drivers/video/bf537-lq035.c: Add missing IS_ERR test

Author: Julia Lawall <julia@diku.dk> lcd_device_register may return ERR_PTR, so a check is added for this value before the dereference. All of the other changes reorganize the error handling code in this function to avoid duplicating all of it in the added case. In the original code, in one case, the global variable fb_buffer was set …

Lire la suite

fs/btrfs/inode.c: Add missing IS_ERR test

Author: Julia Lawall <julia@diku.dk> After the conditional that precedes the following code, inode may be an ERR_PTR value. This can eg result from a memory allocation failure via the call to btrfs_iget, and thus does not imply that root is different than sub_root. Thus, an IS_ERR check is added to ensure that there is no …

Lire la suite

staging: Fix some incorrect use of positive error codes.

Author: Ralph Loader <suckfish@ihug.co.nz> Use -E… instead of just E… in a few places where negative error codes are expected by a functions callers. These were found by grepping with coccinelle & then inspecting by hand to determine which were bugs. The staging/cxt1e1 driver appears to intentionally use positive E… error codes in some places, …

Lire la suite

e1000e: Use kmemdup rather than duplicating its implementation

Author: Bruce Allan <bruce.w.allan@intel.com> The semantic patch that makes this output is available in scripts/coccinelle/api/memdup.cocci. More information about semantic patching is available at http://coccinelle.lip6.fr/ Signed-off-by: Bruce Allan Tested-by: Signed-off-by: Jeff Kirsher — drivers/net/e1000e/ethtool.c | 11 ++——— 1 file changed, 2 insertions(+), 9 deletions(-)   diff –git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 323fd12..daa7fe4 100644 — a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c …

Lire la suite

drivers/video/carminefb.c: improve error handling

Author: Julia Lawall <julia@diku.dk> This code had an error handling goto to the wrong place, a misplaced release_mem_region, and a duplicated release_mem_region. The semantic match that finds the double release_mem_region is as follows: (http://coccinelle.lip6.fr/) // @r@ expression e1,e2,e3; position p1,p2,p3; @@ release_mem_region@p1(e1, e2)@p3; … when != request_mem_region(e1,e2,e3) release_mem_region(e1, e2)@p2; @@ expression e

[SCSI] gdth: Add missing call to gdth_ioctl_free

Author: Julia Lawall <julia@diku.dk> Add missing call to gdth_ioctl_free before aborting. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression buf,ha,len,addr,E; @@ buf = gdth_ioctl_alloc(ha, len, FALSE, &addr) … when != false buf != NULL when != true buf == NULL when != \(E = buf\|buf = E\) when != …

Lire la suite

drivers/atm/atmtcp.c: add missing atm_dev_put

Author: Julia Lawall <julia@diku.dk> The earlier call to atm_dev_lookup increases the reference count of dev, so decrease it on the way out. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression x, E; constant C; @@ x = atm_dev_lookup(…); … when != false x != NULL when != true x …

Lire la suite

ALSA: sound/pci/ctxfi/ctpcm.c: Remove potential for use after free

Author: Julia Lawall <julia@diku.dk> In each function, the value apcm is stored in the private_data field of runtime. At the same time the function ct_atc_pcm_free_substream is stored in the private_free field of the same structure. ct_atc_pcm_free_substream dereferences and ultimately frees the value in the private_data field. But each function can exit in an error case …

Lire la suite

USB: xhci: Use GFP_ATOMIC under spin_lock

Author: David Sterba <dsterba@suse.cz> coccinelle check scripts/coccinelle/locks/call_kern.cocci found that in drivers/usb/host/xhci.c an allocation with GFP_KERNEL is done with locks held: xhci_resume spin_lock_irq(xhci->lock) xhci_setup_msix kmalloc(GFP_KERNEL) Change it to GFP_ATOMIC. Signed-off-by: David Sterba CC: Sarah Sharp Signed-off-by: Greg Kroah-Hartman — drivers/usb/host/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)   diff –git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index …

Lire la suite

fs/ocfs2/dlm: Use GFP_ATOMIC under spin_lock

Author: David Sterba <dsterba@suse.cz> coccinelle check scripts/coccinelle/locks/call_kern.cocci found that in fs/ocfs2/dlm/dlmdomain.c an allocation with GFP_KERNEL is done with locks held: dlm_query_region_handler spin_lock(dlm_domain_lock) dlm_match_regions kmalloc(GFP_KERNEL) Change it to GFP_ATOMIC. Signed-off-by: David Sterba CC: Joel Becker CC: Mark Fasheh CC: ocfs2-devel@oss.oracle.com — Exists in v2.6.37-rc1 and current linux-next. Signed-off-by: Joel Becker — fs/ocfs2/dlm/dlmdomain.c | 2 +- 1 …

Lire la suite