summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLijun Ou <oulijun@huawei.com>2018-07-25 15:29:37 +0800
committerJason Gunthorpe <jgg@mellanox.com>2018-07-26 16:51:34 -0600
commit26f63b9c33ceda12fb9136a1d0c80e03c9ebb514 (patch)
treea279d24079d1284700af5511cf9fbc066344a148
parentdedf63506a8e55235edf902fa7455cd2974e462d (diff)
downloadlinux-26f63b9c33ceda12fb9136a1d0c80e03c9ebb514.tar.bz2
RDMA/hns: Add illegal hop_num judgement
When hop_num is more than three, it need to return -EINVAL. This patch fixes it. Signed-off-by: Lijun Ou <oulijun@huawei.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/hw/hns/hns_roce_hem.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c
index 63b5b3edabcb..8dc336a85128 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hem.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hem.c
@@ -494,6 +494,9 @@ static int hns_roce_table_mhop_get(struct hns_roce_dev *hr_dev,
step_idx = 1;
} else if (hop_num == HNS_ROCE_HOP_NUM_0) {
step_idx = 0;
+ } else {
+ ret = -EINVAL;
+ goto err_dma_alloc_l1;
}
/* set HEM base address to hardware */