public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* re: IB/mlx5: Add create and destroy functionality for Raw Packet QP
@ 2016-01-26  1:08 Dan Carpenter
  2016-01-26  8:48 ` Majd Dibbiny
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-01-26  1:08 UTC (permalink / raw)
  To: majd-VPRAkNaXOzVWk0Htik3J/w; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hello majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,

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

The patch 0fb2ed66a14c: "IB/mlx5: Add create and destroy 
functionality for Raw Packet QP" from Jan 14, 2016, leads to the 
following Smatch complaint:

drivers/infiniband/hw/mlx5/qp.c:1629 mlx5_ib_create_qp()
	 error: we previously assumed 'pd' could be null (see line 1616)

drivers/infiniband/hw/mlx5/qp.c
  1615	
  1616		if (pd) {
                    ^^
Check for NULL.

  1617			dev = to_mdev(pd->device);
  1618		} else {
  1619			/* being cautious here */
  1620			if (init_attr->qp_type != IB_QPT_XRC_TGT &&
  1621			    init_attr->qp_type != MLX5_IB_QPT_REG_UMR) {
  1622				pr_warn("%s: no PD for transport %s\n", __func__,
  1623					ib_qp_type_str(init_attr->qp_type));
  1624				return ERR_PTR(-EINVAL);
  1625			}
  1626			dev = to_mdev(to_mxrcd(init_attr->xrcd)->ibxrcd.device);
  1627	
  1628			if (init_attr->qp_type == IB_QPT_RAW_PACKET) {
  1629				if (!pd->uobject) {
                                     ^^^^^^^^^^^
Patch adds new NULL dereferences.

  1630					mlx5_ib_dbg(dev, "Raw Packet QP is not supported for kernel consumers\n");
  1631					return ERR_PTR(-EINVAL);

regards,
dan carpenter
--
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: IB/mlx5: Add create and destroy functionality for Raw Packet QP
  2016-01-26  1:08 IB/mlx5: Add create and destroy functionality for Raw Packet QP Dan Carpenter
@ 2016-01-26  8:48 ` Majd Dibbiny
  0 siblings, 0 replies; 2+ messages in thread
From: Majd Dibbiny @ 2016-01-26  8:48 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On 26/1/2016 3:08 AM, Dan Carpenter wrote:
> Hello majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 0fb2ed66a14c: "IB/mlx5: Add create and destroy 
> functionality for Raw Packet QP" from Jan 14, 2016, leads to the 
> following Smatch complaint:
Thanks Dan!
I'm working on a fix and will send it soon.
> drivers/infiniband/hw/mlx5/qp.c:1629 mlx5_ib_create_qp()
> 	 error: we previously assumed 'pd' could be null (see line 1616)
>
> drivers/infiniband/hw/mlx5/qp.c
>   1615	
>   1616		if (pd) {
>                     ^^
> Check for NULL.
>
>   1617			dev = to_mdev(pd->device);
>   1618		} else {
>   1619			/* being cautious here */
>   1620			if (init_attr->qp_type != IB_QPT_XRC_TGT &&
>   1621			    init_attr->qp_type != MLX5_IB_QPT_REG_UMR) {
>   1622				pr_warn("%s: no PD for transport %s\n", __func__,
>   1623					ib_qp_type_str(init_attr->qp_type));
>   1624				return ERR_PTR(-EINVAL);
>   1625			}
>   1626			dev = to_mdev(to_mxrcd(init_attr->xrcd)->ibxrcd.device);
>   1627	
>   1628			if (init_attr->qp_type == IB_QPT_RAW_PACKET) {
>   1629				if (!pd->uobject) {
>                                      ^^^^^^^^^^^
> Patch adds new NULL dereferences.
>
>   1630					mlx5_ib_dbg(dev, "Raw Packet QP is not supported for kernel consumers\n");
>   1631					return ERR_PTR(-EINVAL);
>
> regards,
> dan carpenter

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-26  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-26  1:08 IB/mlx5: Add create and destroy functionality for Raw Packet QP Dan Carpenter
2016-01-26  8:48 ` Majd Dibbiny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox