Subject: Re: [RFC 12/20] RDMA/irdma: Implement device supported verb APIs

From: Leon Romanovsky <[email-masked]>
Date: Thu, 26 Sep 2019 20:37:10 +0300

On Thu, Sep 26, 2019 at 09:45:11AM -0700, Jeff Kirsher wrote:
> From: Mustafa Ismail <[email-masked]>
>
> Implement device supported verb APIs. The supported APIs
> vary based on the underlying transport the ibdev is
> registered as (i.e. iWARP or RoCEv2).
>
> Signed-off-by: Mustafa Ismail <[email-masked]>
> Signed-off-by: Shiraz Saleem <[email-masked]>
> ---
>  drivers/infiniband/hw/irdma/verbs.c      | 4346 ++++++++++++++++++++++
>  drivers/infiniband/hw/irdma/verbs.h      |  199 +
>  include/uapi/rdma/rdma_user_ioctl_cmds.h |    1 +
>  3 files changed, 4546 insertions(+)
>  create mode 100644 drivers/infiniband/hw/irdma/verbs.c
>  create mode 100644 drivers/infiniband/hw/irdma/verbs.h
>
> diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
> new file mode 100644
> index 000000000000..025c21c722e2
> --- /dev/null
> +++ b/drivers/infiniband/hw/irdma/verbs.c
> @@ -0,0 +1,4346 @@
> +// SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB
> +/* Copyright (c) 2019, Intel Corporation. */

<...>

> +
> +	size = sqdepth * sizeof(struct irdma_sq_uk_wr_trk_info) +
> +	       (rqdepth << 3);
> +	iwqp->kqp.wrid_mem = kzalloc(size, GFP_KERNEL);
> +	if (!iwqp->kqp.wrid_mem)
> +		return -ENOMEM;
> +
> +	ukinfo->sq_wrtrk_array = (struct irdma_sq_uk_wr_trk_info *)
> +				 iwqp->kqp.wrid_mem;
> +	if (!ukinfo->sq_wrtrk_array)
> +		return -ENOMEM;

You are leaking resources here, forgot to do proper error unwinding.

Thanks