Skip to contentSkip to conversation

RDMA/mlx5: Check for ERR_PTR from uverbs_zalloc()

PATCH Applied Jason Gunthorpe 2 participants 3 messages Nov 24, 2020 – Nov 26, 2020

Subsystems (2)
lore
Share & tools
lore

Jason Gunthorpe

author maintainer
#0 lore raw

PATCH 1/1 RDMA/mlx5: Check for ERR_PTR from uverbs_zalloc()

The return code from uverbs_zalloc() was wrongly checked, it is ERR_PTR not NULL like other allocators:

drivers/infiniband/hw/mlx5/devx.c:2110 devx_umem_reg_cmd_alloc() warn: passing zero to 'PTR_ERR'

Fixes 878f7b31c3a7 ("RDMA/mlx5: Use ib_umem_find_best_pgsz() for devx")
---
 drivers/infiniband/hw/mlx5/devx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/devx.c +1 -1
index 7c3eefba619716..ad0173f62c0e95 100644
@@ -2106,7 +2106,7 @@ static int devx_umem_reg_cmd_alloc(struct mlx5_ib_dev *dev,
 		     (MLX5_ST_SZ_BYTES(mtt) *
 		      ib_umem_num_dma_blocks(obj->umem, page_size));
 	cmd->in = uverbs_zalloc(attrs, cmd->inlen);
-	if (!cmd->in)
+	if (IS_ERR(cmd->in))
 		return PTR_ERR(cmd->in);
 
 	umem = MLX5_ADDR_OF(create_umem_in, cmd->in, umem);
Signature · 1 line
2.29.2
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Jason Gunthorpe

The return code from uverbs_zalloc() was wrongly checked, it is ERR_PTR not NULL like other allocators:

drivers/infiniband/hw/mlx5/devx.c:2110 devx_umem_reg_cmd_alloc() warn: passing zero to 'PTR_ERR'

Fixes 878f7b31c3a7 ("RDMA/mlx5: Use ib_umem_find_best_pgsz() for devx")
---
 drivers/infiniband/hw/mlx5/devx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

author maintainer Applied
#2 lore raw
In reply to Jason Gunthorpe
Quoted 5 lines · Jason Gunthorpe

The return code from uverbs_zalloc() was wrongly checked, it is ERR_PTR not NULL like other allocators:

drivers/infiniband/hw/mlx5/devx.c:2110 devx_umem_reg_cmd_alloc() warn: passing zero to 'PTR_ERR'

Quoted 7 lines
Fixes 878f7b31c3a7 ("RDMA/mlx5: Use ib_umem_find_best_pgsz() for devx")
---
 drivers/infiniband/hw/mlx5/devx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next

Jason