Message ID | 20201127074349.GA7391@mwanda (mailing list archive) |
---|---|
State | Rejected |
Headers | show |
Series | RDMA/mlx5: Fix a error code in devx_umem_reg_cmd_alloc() | expand |
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
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);
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(-)