Skip to contentSkip to conversation

IB/uverbs: Signedness bug in UVERBS_HANDLER()

PATCH Applied Dan Carpenter 3 participants 3 messages Dec 22, 2018

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

PATCH 1/1 IB/uverbs: Signedness bug in UVERBS_HANDLER()

The "num_sge" variable needs to be signed for the error handling to work. The uverbs_attr_ptr_get_array_size() returns int so this change is safe.

Fixes ad8a4496757f ("IB/uverbs: Add support to advise_mr")
---
 drivers/infiniband/core/uverbs_std_types_mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/uverbs_std_types_mr.c +1 -1
index 71dfa5e5938e..4d4be0c2b752 100644
@@ -47,7 +47,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_ADVISE_MR)(
 	enum ib_uverbs_advise_mr_advice advice;
 	struct ib_device *ib_dev = pd->device;
 	struct ib_sge *sg_list;
-	u32 num_sge;
+	int num_sge;
 	u32 flags;
 	int ret;
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Dan Carpenter

The "num_sge" variable needs to be signed for the error handling to work. The uverbs_attr_ptr_get_array_size() returns int so this change is safe.

Fixes ad8a4496757f ("IB/uverbs: Add support to advise_mr")
---
 drivers/infiniband/core/uverbs_std_types_mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks,

#2 lore raw
In reply to Dan Carpenter
Quoted 10 lines · Dan Carpenter

The "num_sge" variable needs to be signed for the error handling to work. The uverbs_attr_ptr_get_array_size() returns int so this change is safe.

Fixes ad8a4496757f ("IB/uverbs: Add support to advise_mr")
---
 drivers/infiniband/core/uverbs_std_types_mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next

Thanks,
Jason