OSDN Git Service

IB/uverbs: Signedness bug in UVERBS_HANDLER()
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 22 Dec 2018 07:42:59 +0000 (10:42 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Sat, 22 Dec 2018 23:07:13 +0000 (16:07 -0700)
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>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/uverbs_std_types_mr.c

index 71dfa5e..4d4be0c 100644 (file)
@@ -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;