Skip to contentSkip to conversation

RDMA/uverbs: fix a NULL vs IS_ERR() bug

PATCH Applied Dan Carpenter 3 participants 3 messages May 14, 2021 – May 19, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/uverbs: fix a NULL vs IS_ERR() bug

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")
---
 drivers/infiniband/core/uverbs_std_types_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/core/uverbs_std_types_device.c +2 -2
index 9ec6971056fa..818704c676c0 100644
@@ -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);
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dan Carpenter

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")
---
 drivers/infiniband/core/uverbs_std_types_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks,

maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 9 lines · Dan Carpenter

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")
---
 drivers/infiniband/core/uverbs_std_types_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to for-rc, thanks

Jason