]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/hns: Add illegal hop_num judgement
authorLijun Ou <oulijun@huawei.com>
Wed, 25 Jul 2018 07:29:37 +0000 (15:29 +0800)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 26 Jul 2018 22:51:34 +0000 (16:51 -0600)
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>
drivers/infiniband/hw/hns/hns_roce_hem.c

index 63b5b3edabcbad7b9ea6a002334a62433fef8a6a..8dc336a85128f4eccdb92115dcd8ea72a42cbdd3 100644 (file)
@@ -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 */