浏览代码

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>
Lijun Ou 7 年之前
父节点
当前提交
26f63b9c33
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/infiniband/hw/hns/hns_roce_hem.c

+ 3 - 0
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 */