re: mlx5: Add driver for Mellanox Connect-IB adapters

2 messages, 2 authors, 2014-06-26 · open the first message on its own page

re: mlx5: Add driver for Mellanox Connect-IB adapters

From: Dan Carpenter <hidden>
Date: 2014-06-20 17:58:32

Hello Eli Cohen,

This is a semi-automatic email about new static checker warnings.

The patch e126ba97dba9: "mlx5: Add driver for Mellanox Connect-IB 
adapters" from Jul 7, 2013, leads to the following Smatch complaint:

drivers/infiniband/hw/mlx5/qp.c:979 create_qp_common()
	 error: we previously assumed 'pd->uobject' could be null (see line 847)

drivers/infiniband/hw/mlx5/qp.c
   846		if (pd) {
   847			if (pd->uobject) {
                            ^^^^^^^^^^^
There are a bunch of checks for pd->uobject.

   848				mlx5_ib_dbg(dev, "requested sq_wqe_count (%d)\n", ucmd.sq_wqe_count);
   849				if (ucmd.rq_wqe_shift != qp->rq.wqe_shift ||
   850				    ucmd.rq_wqe_count != qp->rq.wqe_cnt) {
   851					mlx5_ib_dbg(dev, "invalid rq params\n");
   852					return -EINVAL;
   853				}
   854				if (ucmd.sq_wqe_count > dev->mdev.caps.max_wqes) {
   855					mlx5_ib_dbg(dev, "requested sq_wqe_count (%d) > max allowed (%d)\n",

[ snip ]

   971		qp->doorbell_qpn = swab32(qp->mqp.qpn << 8);
   972	
   973		qp->mqp.event = mlx5_ib_qp_event;
   974	
   975		return 0;
   976	
   977	err_create:
   978		if (qp->create_type == MLX5_QP_USER)
   979			destroy_qp_user(pd, qp);
                        ^^^^^^^^^^^^^^^
But we dereference it inside destroy_qp_user() unconditionally.

   980		else if (qp->create_type == MLX5_QP_KERNEL)

8 more lines

Re: mlx5: Add driver for Mellanox Connect-IB adapters

From: Eli Cohen <hidden>
Date: 2014-06-26 10:37:43

On Fri, Jun 20, 2014 at 08:58:32PM +0300, Dan Carpenter wrote:
   976	
   977	err_create:
   978		if (qp->create_type == MLX5_QP_USER)
   979			destroy_qp_user(pd, qp);
                        ^^^^^^^^^^^^^^^
But we dereference it inside destroy_qp_user() unconditionally.

   980		else if (qp->create_type == MLX5_QP_KERNEL)
   981			destroy_qp_kernel(dev, qp);
When we get here we already updated create_type and since all
MLX5_QP_USER type QPs have PD the logic is not broken.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help