Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] RDMA/mlx5: Fix a error code in devx_umem_reg_cmd_alloc()
@ 2020-11-27  7:43 Dan Carpenter
  2020-11-27 13:05 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-11-27  7:43 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, kernel-janitors

This code returns PTR_ERR(NULL) which is zero or success but it should
return -ENOMEM.

Fixes: 878f7b31c3a7 ("RDMA/mlx5: Use ib_umem_find_best_pgsz() for devx")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/infiniband/hw/mlx5/devx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index 7c3eefba6197..0b87c74281d3 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -2107,7 +2107,7 @@ static int devx_umem_reg_cmd_alloc(struct mlx5_ib_dev *dev,
 		      ib_umem_num_dma_blocks(obj->umem, page_size));
 	cmd->in = uverbs_zalloc(attrs, cmd->inlen);
 	if (!cmd->in)
-		return PTR_ERR(cmd->in);
+		return -ENOMEM;
 
 	umem = MLX5_ADDR_OF(create_umem_in, cmd->in, umem);
 	mtt = (__be64 *)MLX5_ADDR_OF(umem, umem, mtt);
-- 
2.29.2


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

* Re: [PATCH] RDMA/mlx5: Fix a error code in devx_umem_reg_cmd_alloc()
  2020-11-27  7:43 [PATCH] RDMA/mlx5: Fix a error code in devx_umem_reg_cmd_alloc() Dan Carpenter
@ 2020-11-27 13:05 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2020-11-27 13:05 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Leon Romanovsky, Doug Ledford, linux-rdma, kernel-janitors

On Fri, Nov 27, 2020 at 10:43:49AM +0300, Dan Carpenter wrote:
> This code returns PTR_ERR(NULL) which is zero or success but it should
> return -ENOMEM.
> 
> Fixes: 878f7b31c3a7 ("RDMA/mlx5: Use ib_umem_find_best_pgsz() for devx")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/infiniband/hw/mlx5/devx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Not quite, it is worse, cmd->in is never NULL in the first place

https://lore.kernel.org/linux-rdma/0-v1-4d05ccc1c223+173-devx_err_ptr_jgg@nvidia.com/

Jason

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

end of thread, other threads:[~2020-11-27 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-27  7:43 [PATCH] RDMA/mlx5: Fix a error code in devx_umem_reg_cmd_alloc() Dan Carpenter
2020-11-27 13:05 ` Jason Gunthorpe

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