]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
RDMA/hns: Fix the bug while use multi-hop of pbl
authorLijun Ou <oulijun@huawei.com>
Sat, 8 Dec 2018 10:40:09 +0000 (18:40 +0800)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:21:51 +0000 (14:21 -0300)
BugLink: https://bugs.launchpad.net/bugs/1855787
[ Upstream commit 4af07f01f7a787ba5158352b98c9e3cb74995a1c ]

It will prevent multiply overflow when defines the pbl for u64 type.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/infiniband/hw/hns/hns_roce_mr.c

index ba6263d471da62ef431c92516e807291aafd51e1..1457d7a889f236f34724e6e7bee99d5cc99bcc04 100644 (file)
@@ -1017,14 +1017,14 @@ struct ib_mr *hns_roce_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
                        goto err_umem;
                }
        } else {
-               int pbl_size = 1;
+               u64 pbl_size = 1;
 
                bt_size = (1 << (hr_dev->caps.pbl_ba_pg_sz + PAGE_SHIFT)) / 8;
                for (i = 0; i < hr_dev->caps.pbl_hop_num; i++)
                        pbl_size *= bt_size;
                if (n > pbl_size) {
                        dev_err(dev,
-                           " MR len %lld err. MR page num is limited to %d!\n",
+                           " MR len %lld err. MR page num is limited to %lld!\n",
                            length, pbl_size);
                        ret = -EINVAL;
                        goto err_umem;