public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/uverbs: fix a NULL vs IS_ERR() bug
@ 2021-05-14 14:18 Dan Carpenter
  2021-05-19  5:37 ` Leon Romanovsky
  2021-05-19 22:50 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-05-14 14:18 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, Avihai Horon, Michael Guralnik, Aharon Landau,
	Gal Pressman, Yishai Hadas, Parav Pandit, linux-rdma,
	kernel-janitors

The uapi_get_object() function returns error pointers, it never returns
NULL.

Fixes: 149d3845f4a5 ("RDMA/uverbs: Add a method to introspect handles in a context")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/infiniband/core/uverbs_std_types_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/uverbs_std_types_device.c b/drivers/infiniband/core/uverbs_std_types_device.c
index 9ec6971056fa..818704c676c0 100644
--- a/drivers/infiniband/core/uverbs_std_types_device.c
+++ b/drivers/infiniband/core/uverbs_std_types_device.c
@@ -117,8 +117,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_INFO_HANDLES)(
 		return ret;
 
 	uapi_object = uapi_get_object(attrs->ufile->device->uapi, object_id);
-	if (!uapi_object)
-		return -EINVAL;
+	if (IS_ERR(uapi_object))
+		return PTR_ERR(uapi_object);
 
 	handles = gather_objects_handle(attrs->ufile, uapi_object, attrs,
 					out_len, &total);
-- 
2.30.2


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

* Re: [PATCH] RDMA/uverbs: fix a NULL vs IS_ERR() bug
  2021-05-14 14:18 [PATCH] RDMA/uverbs: fix a NULL vs IS_ERR() bug Dan Carpenter
@ 2021-05-19  5:37 ` Leon Romanovsky
  2021-05-19 22:50 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2021-05-19  5:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Doug Ledford, Jason Gunthorpe, Avihai Horon, Michael Guralnik,
	Aharon Landau, Gal Pressman, Yishai Hadas, Parav Pandit,
	linux-rdma, kernel-janitors

On Fri, May 14, 2021 at 05:18:10PM +0300, Dan Carpenter wrote:
> The uapi_get_object() function returns error pointers, it never returns
> NULL.
> 
> Fixes: 149d3845f4a5 ("RDMA/uverbs: Add a method to introspect handles in a context")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/infiniband/core/uverbs_std_types_device.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH] RDMA/uverbs: fix a NULL vs IS_ERR() bug
  2021-05-14 14:18 [PATCH] RDMA/uverbs: fix a NULL vs IS_ERR() bug Dan Carpenter
  2021-05-19  5:37 ` Leon Romanovsky
@ 2021-05-19 22:50 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2021-05-19 22:50 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Doug Ledford, Leon Romanovsky, Avihai Horon, Michael Guralnik,
	Aharon Landau, Gal Pressman, Yishai Hadas, Parav Pandit,
	linux-rdma, kernel-janitors

On Fri, May 14, 2021 at 05:18:10PM +0300, Dan Carpenter wrote:
> The uapi_get_object() function returns error pointers, it never returns
> NULL.
> 
> Fixes: 149d3845f4a5 ("RDMA/uverbs: Add a method to introspect handles in a context")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/core/uverbs_std_types_device.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to for-rc, thanks

Jason

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

end of thread, other threads:[~2021-05-19 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-14 14:18 [PATCH] RDMA/uverbs: fix a NULL vs IS_ERR() bug Dan Carpenter
2021-05-19  5:37 ` Leon Romanovsky
2021-05-19 22:50 ` Jason Gunthorpe

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