diff mbox series

IB/uverbs: Signedness bug in UVERBS_HANDLER()

Message ID 20181222074259.GA6338@kadam (mailing list archive)
State Accepted
Commit 573671a5f6509c4139770452d4516720a84d5b61
Delegated to: Jason Gunthorpe
Headers show
Series IB/uverbs: Signedness bug in UVERBS_HANDLER() | expand

Commit Message

Dan Carpenter Dec. 22, 2018, 7:42 a.m. UTC
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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/infiniband/core/uverbs_std_types_mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky Dec. 22, 2018, 8:37 a.m. UTC | #1
On Sat, Dec 22, 2018 at 10:42:59AM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/infiniband/core/uverbs_std_types_mr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Jason Gunthorpe Dec. 22, 2018, 11:09 p.m. UTC | #2
On Sat, Dec 22, 2018 at 10:42:59AM +0300, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/core/uverbs_std_types_mr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next

Thanks,
Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/core/uverbs_std_types_mr.c b/drivers/infiniband/core/uverbs_std_types_mr.c
index 71dfa5e5938e..4d4be0c2b752 100644
--- a/drivers/infiniband/core/uverbs_std_types_mr.c
+++ b/drivers/infiniband/core/uverbs_std_types_mr.c
@@ -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;