pch_uart: check kzalloc result in dma_handle_tx()

Author: Fengguang Wu <fengguang.wu@intel.com> Reported by coccinelle: drivers/tty/serial/pch_uart.c:979:1-14: alloc with no test, possible model on line 994 Signed-off-by: Fengguang Wu Signed-off-by: Greg Kroah-Hartman — drivers/tty/serial/pch_uart.c | 4 ++++ 1 file changed, 4 insertions(+)   diff –git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index 558ce85..4cd6c23 100644 — a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c @@ -979,6 +979,10 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) …

Continue reading

floppy: remove duplicated flag FD_RAW_NEED_DISK

Author: Fengguang Wu <fengguang.wu@intel.com> Fix coccinelle warning (without behavior change): drivers/block/floppy.c:2518:32-48: duplicated argument to & or | Signed-off-by: Fengguang Wu Signed-off-by: Jiri Kosina — drivers/block/floppy.c | 3 +– 1 file changed, 1 insertion(+), 2 deletions(-)   diff –git a/drivers/block/floppy.c b/drivers/block/floppy.c index 1347ba8..9d6ef68 100644 — a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -2516,8 +2516,7 @@ static int make_raw_rw_request(void) set_fdc((long)current_req->rq_disk->private_data); …

Continue reading

RDMA/ucma: Convert open-coded equivalent to memdup_user()

Author: Roland Dreier <roland@purestorage.com> Suggested by scripts/coccinelle/api/memdup_user.cocci. Reported-by: Fengguang Wu Signed-off-by: Roland Dreier — drivers/infiniband/core/ucma.c | 19 +++++++———— 1 file changed, 7 insertions(+), 12 deletions(-)   diff –git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 893cb87..6bf8504 100644 — a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -1002,23 +1002,18 @@ static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf, if (IS_ERR(ctx)) return PTR_ERR(ctx);   …

Continue reading

RDMA/ocrdma: Fix check of GSI CQs

Author: Roland Dreier <roland@purestorage.com> It looks like one check was accidentally duplicated, and the other 3 checks were left out. This was detected by scripts/coccinelle/tests/doubletest.cocci: drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:895:6-54: duplicated argument to && or || Reported-by: Fengguang Wu Signed-off-by: Roland Dreier — drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)   diff –git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c …

Continue reading

RDMA/cma: Use PTR_RET rather than if (IS_ERR(…)) + PTR_ERR

Author: Fengguang Wu <fengguang.wu@intel.com> Suggested by scripts/coccinelle/api/ptr_ret.cocci. Signed-off-by: Roland Dreier — drivers/infiniband/core/cma.c | 5 +—- 1 file changed, 1 insertion(+), 4 deletions(-)   diff –git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 5a335b5..7172559 100644 — a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -3064,10 +3064,7 @@ static int cma_join_ib_multicast(struct rdma_id_private *id_priv, id_priv->id.port_num, &rec, comp_mask, GFP_KERNEL, cma_ib_mc_handler, mc); – if (IS_ERR(mc->multicast.ib)) – return PTR_ERR(mc->multicast.ib); …

Continue reading

bcma: add missing iounmap on error path

Author: Hauke Mehrtens <hauke@hauke-m.de> This should fix the problem reported by Fengguang: The coccinelle static checker emits these warnings: drivers/bcma/scan.c:466:3-9: ERROR: missing iounmap; ioremap on line 451 and execution via conditional on line 465 drivers/bcma/scan.c:540:3-9: ERROR: missing iounmap; ioremap on line 515 and execution via conditional on line 539 Reported-by: Fengguang Wu Signed-off-by: Hauke Mehrtens …

Continue reading

mmc: vub300: add missing usb_free_urb

Author: Julia Lawall <Julia.Lawall@lip6.fr> Add missing usb_free_urb on failure path after usb_alloc_urb. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @km exists@ local idexpression e; expression e1,e2,e3; type T,T1; identifier f; @@ * e = usb_alloc_urb(…) … when any when != e = e1 when != e1 …

Continue reading

iommu/intel: add missing free_domain_mem

Author: Julia Lawall <Julia.Lawall@lip6.fr> Add missing free_domain_mem on failure path after alloc_domain. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @km exists@ local idexpression e; expression e1,e2,e3; type T,T1; identifier f; @@ * e = alloc_domain(…) … when any when != e = e1 when != e1 …

Continue reading

[media] drivers/staging/media/easycap/easycap_main.c: add missing usb_free_urb

Author: Julia Lawall <Julia.Lawall@lip6.fr> Add missing usb_free_urb on failure path after usb_alloc_urb. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @km exists@ local idexpression e; expression e1,e2,e3; type T,T1; identifier f; @@ * e = usb_alloc_urb(…) … when any when != e = e1 when != e1 …

Continue reading

PCI: hotplug: ensure a consistent return value in error case

Author: Julia Lawall <Julia.Lawall@lip6.fr> Typically, the return value desired for the failure of a function with an integer return value is a negative integer. In these cases, the return value is sometimes a negative integer and sometimes 0, due to a subsequent initialization of the return variable within the loop. A simplified version of the …

Continue reading