diff mbox

RDMA/qedr: Missing error code in qedr_init_user_queue()

Message ID 20170825081839.5ahvp6pehrhyyf2z@mwanda (mailing list archive)
State Accepted
Headers show

Commit Message

Dan Carpenter Aug. 25, 2017, 8:18 a.m. UTC
We should return -ENOMEM if the kzalloc() fails.  We currently return
success.

Fixes: 69ad0e7fe845 ("RDMA/qedr: Add support for iWARP in user space")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Doug Ledford Aug. 29, 2017, 12:36 a.m. UTC | #1
On Fri, 2017-08-25 at 11:18 +0300, Dan Carpenter wrote:
> We should return -ENOMEM if the kzalloc() fails.  We currently return
> success.
> 
> Fixes: 69ad0e7fe845 ("RDMA/qedr: Add support for iWARP in user
> space")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied on top of my k.o/net-next-based branch.

> 
> diff --git a/drivers/infiniband/hw/qedr/verbs.c
> b/drivers/infiniband/hw/qedr/verbs.c
> index 4e14a558734b..bce4f79370e6 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -821,8 +821,10 @@ static inline int qedr_init_user_queue(struct
> ib_ucontext *ib_ctx,
>  				   FW_PAGE_SHIFT);
>  	} else {
>  		q->pbl_tbl = kzalloc(sizeof(*q->pbl_tbl),
> GFP_KERNEL);
> -		if (!q->pbl_tbl)
> +		if (!q->pbl_tbl) {
> +			rc = -ENOMEM;
>  			goto err0;
> +		}
>  	}
>  
>  	return 0;
Kalderon, Michal Aug. 29, 2017, 7:02 a.m. UTC | #2
From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
Sent: Friday, August 25, 2017 11:19 AM
> To: Amrani, Ram <Ram.Amrani@cavium.com>; Kalderon@mwanda;
> Kalderon, Michal <Michal.Kalderon@cavium.com>
> Cc: Elior, Ariel <Ariel.Elior@cavium.com>; Doug Ledford
> <dledford@redhat.com>; Sean Hefty <sean.hefty@intel.com>; Hal
> Rosenstock <hal.rosenstock@gmail.com>; linux-rdma@vger.kernel.org;
> kernel-janitors@vger.kernel.org
> Subject: [PATCH] RDMA/qedr: Missing error code in qedr_init_user_queue()
> 
> We should return -ENOMEM if the kzalloc() fails.  We currently return
> success.
> 
> Fixes: 69ad0e7fe845 ("RDMA/qedr: Add support for iWARP in user space")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/infiniband/hw/qedr/verbs.c
> b/drivers/infiniband/hw/qedr/verbs.c
> index 4e14a558734b..bce4f79370e6 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -821,8 +821,10 @@ static inline int qedr_init_user_queue(struct
> ib_ucontext *ib_ctx,
>  				   FW_PAGE_SHIFT);
>  	} else {
>  		q->pbl_tbl = kzalloc(sizeof(*q->pbl_tbl), GFP_KERNEL);
> -		if (!q->pbl_tbl)
> +		if (!q->pbl_tbl) {
> +			rc = -ENOMEM;
>  			goto err0;
> +		}
>  	}
> 
>  	return 0;

Thanks, Dan

Acked-by: Michal Kalderon <Michal.Kalderon@cavium.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 4e14a558734b..bce4f79370e6 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -821,8 +821,10 @@  static inline int qedr_init_user_queue(struct ib_ucontext *ib_ctx,
 				   FW_PAGE_SHIFT);
 	} else {
 		q->pbl_tbl = kzalloc(sizeof(*q->pbl_tbl), GFP_KERNEL);
-		if (!q->pbl_tbl)
+		if (!q->pbl_tbl) {
+			rc = -ENOMEM;
 			goto err0;
+		}
 	}
 
 	return 0;