* [PATCH] RDMA/mlx5: Check for ERR_PTR from uverbs_zalloc()
@ 2020-11-24 23:34 Jason Gunthorpe
2020-11-25 6:15 ` Leon Romanovsky
2020-11-26 19:57 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-11-24 23:34 UTC (permalink / raw)
To: linux-rdma; +Cc: Leon Romanovsky, Leon Romanovsky, Yishai Hadas
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")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.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 7c3eefba619716..ad0173f62c0e95 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -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);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/mlx5: Check for ERR_PTR from uverbs_zalloc()
2020-11-24 23:34 [PATCH] RDMA/mlx5: Check for ERR_PTR from uverbs_zalloc() Jason Gunthorpe
@ 2020-11-25 6:15 ` Leon Romanovsky
2020-11-26 19:57 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2020-11-25 6:15 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: linux-rdma, Yishai Hadas
On Tue, Nov 24, 2020 at 07:34:33PM -0400, Jason Gunthorpe wrote:
> 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")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/infiniband/hw/mlx5/devx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Thanks,
Acked-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/mlx5: Check for ERR_PTR from uverbs_zalloc()
2020-11-24 23:34 [PATCH] RDMA/mlx5: Check for ERR_PTR from uverbs_zalloc() Jason Gunthorpe
2020-11-25 6:15 ` Leon Romanovsky
@ 2020-11-26 19:57 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-11-26 19:57 UTC (permalink / raw)
To: linux-rdma; +Cc: Leon Romanovsky, Leon Romanovsky, Yishai Hadas
On Tue, Nov 24, 2020 at 07:34:33PM -0400, Jason Gunthorpe wrote:
> 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")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> Acked-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> drivers/infiniband/hw/mlx5/devx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to for-next
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-26 19:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 23:34 [PATCH] RDMA/mlx5: Check for ERR_PTR from uverbs_zalloc() Jason Gunthorpe
2020-11-25 6:15 ` Leon Romanovsky
2020-11-26 19:57 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).