public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/mlx5: Fix an error code in __mlx5_ib_modify_qp()
@ 2018-03-06 10:00 Dan Carpenter
  2018-03-06 10:20 ` Leon Romanovsky
  2018-03-07  3:20 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-03-06 10:00 UTC (permalink / raw)
  To: kernel-janitors

"err" is either zero or possibly uninitialized here.  It should be
-EINVAL.

Fixes: 427c1e7bcd7e ("{IB, net}/mlx5: Move the modify QP operation table to mlx5_ib")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 90bb96292fc4..f9a1174ad7fa 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -3118,8 +3118,10 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
 	mlx5_new = to_mlx5_state(new_state);
 
 	if (mlx5_cur >= MLX5_QP_NUM_STATE || mlx5_new >= MLX5_QP_NUM_STATE ||
-	    !optab[mlx5_cur][mlx5_new])
+	    !optab[mlx5_cur][mlx5_new]) {
+		err = -EINVAL;
 		goto out;
+	}
 
 	op = optab[mlx5_cur][mlx5_new];
 	optpar = ib_mask_to_mlx5_opt(attr_mask);

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

* Re: [PATCH] IB/mlx5: Fix an error code in __mlx5_ib_modify_qp()
  2018-03-06 10:00 [PATCH] IB/mlx5: Fix an error code in __mlx5_ib_modify_qp() Dan Carpenter
@ 2018-03-06 10:20 ` Leon Romanovsky
  2018-03-07  3:20 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2018-03-06 10:20 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

On Tue, Mar 06, 2018 at 01:00:31PM +0300, Dan Carpenter wrote:
> "err" is either zero or possibly uninitialized here.  It should be
> -EINVAL.
>
> Fixes: 427c1e7bcd7e ("{IB, net}/mlx5: Move the modify QP operation table to mlx5_ib")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
> index 90bb96292fc4..f9a1174ad7fa 100644
> --- a/drivers/infiniband/hw/mlx5/qp.c
> +++ b/drivers/infiniband/hw/mlx5/qp.c
> @@ -3118,8 +3118,10 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
>  	mlx5_new = to_mlx5_state(new_state);
>
>  	if (mlx5_cur >= MLX5_QP_NUM_STATE || mlx5_new >= MLX5_QP_NUM_STATE ||
> -	    !optab[mlx5_cur][mlx5_new])
> +	    !optab[mlx5_cur][mlx5_new]) {
> +		err = -EINVAL;
>  		goto out;
> +	}
>

Thanks Dan,
Acked-by: Leon Romanovsky <leonro@mellanox.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] IB/mlx5: Fix an error code in __mlx5_ib_modify_qp()
  2018-03-06 10:00 [PATCH] IB/mlx5: Fix an error code in __mlx5_ib_modify_qp() Dan Carpenter
  2018-03-06 10:20 ` Leon Romanovsky
@ 2018-03-07  3:20 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2018-03-07  3:20 UTC (permalink / raw)
  To: kernel-janitors

On Tue, Mar 06, 2018 at 01:00:31PM +0300, Dan Carpenter wrote:
> "err" is either zero or possibly uninitialized here.  It should be
> -EINVAL.
> 
> Fixes: 427c1e7bcd7e ("{IB, net}/mlx5: Move the modify QP operation table to mlx5_ib")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Acked-by: Leon Romanovsky <leonro@mellanox.com>
> 
> diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
> index 90bb96292fc4..f9a1174ad7fa 100644
> +++ b/drivers/infiniband/hw/mlx5/qp.c
> @@ -3118,8 +3118,10 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
>  	mlx5_new = to_mlx5_state(new_state);
>  
>  	if (mlx5_cur >= MLX5_QP_NUM_STATE || mlx5_new >= MLX5_QP_NUM_STATE ||
> -	    !optab[mlx5_cur][mlx5_new])
> +	    !optab[mlx5_cur][mlx5_new]) {
> +		err = -EINVAL;
>  		goto out;
> +	}
>  
>  	op = optab[mlx5_cur][mlx5_new];
>  	optpar = ib_mask_to_mlx5_opt(attr_mask);

I applied this by hand to for-rc due to context changes

Thanks,
Jason

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

end of thread, other threads:[~2018-03-07  3:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-06 10:00 [PATCH] IB/mlx5: Fix an error code in __mlx5_ib_modify_qp() Dan Carpenter
2018-03-06 10:20 ` Leon Romanovsky
2018-03-07  3:20 ` Jason Gunthorpe

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