Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1618190imm; Fri, 6 Jul 2018 03:30:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfYxjbBW0u3twifjFozRzH3FP4Oc7ZkFNGm52kVNQVxYMwz7R38zJyXMcoAJXDdpUdhmCkR X-Received: by 2002:a17:902:3041:: with SMTP id u59-v6mr9783769plb.208.1530873042520; Fri, 06 Jul 2018 03:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530873042; cv=none; d=google.com; s=arc-20160816; b=V3V3dlgFigNkXqOg9Fci+sLrcflO/XZLb2OEv1XliwUNJbkTWdGdjNgjFP35IXjhL/ Qat2Ax5Ieba4gqUCDlpEuVzqDIhCNY+ref+otxFc8Pj7EcXw0GZXXsVZTmz0XGXCKauJ 5/GGiWe34e+EnHQqrm/Q7yTaYWx2nOy5oNw2m8RgR/Gu4gXpdJAZAW6epf10gHjEMhoG coZqaYYBqYigStIWre6nvLZL7DRN7b7vdFrdJulFJW7YKWKuS/Ld9ponfg61vchIW0Yb gFVTxAQZni8IoDaj5IsB/eygtC1IixePvgugaziTaBtu39d+Szkab2LrxOnwW+6/amYA 9x/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=9A3JCMy7TDUadk496AlIPwoyAn7KfEKOK8QVz4rAtkc=; b=dpJpZ33MxHJBreqYshl2N4Zg6Uba5OzHKsJcRMzmqFbyoJL2DtZzQ4Msdlt+xE3KsM uhENmGABGND6XU5GxULrNhRp94NiQ/60UsmDxsgj4xWdqpYrQBwY2pyWjOvXCkhj7sXZ dYyGPEOWv8TDCFHLP1I7oV9Hyqn43s5zUET2WiTyIQ7TC0u/JQw7KjKd2FY702naWdn0 D4NHJgiaylTOK5neCvcMhUkLHISJYbFL7k5sJ6SfGOLU1gOrI6URdtEwjudk7zXYlTsj EEcVHS56H6qSXLeb7xHEJ2ugkUpaXdjtRd9GjRrlu3ouX96cS1gZVWkjGD9wRsAeiBAZ ZY5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x130-v6si7901233pgx.207.2018.07.06.03.30.27; Fri, 06 Jul 2018 03:30:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932836AbeGFK3c (ORCPT + 99 others); Fri, 6 Jul 2018 06:29:32 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9207 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932771AbeGFK3a (ORCPT ); Fri, 6 Jul 2018 06:29:30 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5CA4F771F5B1A; Fri, 6 Jul 2018 18:29:15 +0800 (CST) Received: from S00293818-DELL1.huawei.com (10.202.226.54) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.382.0; Fri, 6 Jul 2018 18:29:09 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 08/10] net: hns3: Fix get_vector ops in hclgevf_main module Date: Fri, 6 Jul 2018 11:28:02 +0100 Message-ID: <20180706102804.196-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180706102804.196-1-salil.mehta@huawei.com> References: <20180706102804.196-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunsheng Lin The hclgevf_free_vector function expects the caller to pass the vector_id to it, and hclgevf_put_vector pass vector to it now, which will cause vector allocation problem. This patch fixes it by converting vector into vector_id before calling hclgevf_free_vector. Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 5a86532..d1f16f0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -658,8 +658,17 @@ static int hclgevf_unmap_ring_from_vector( static int hclgevf_put_vector(struct hnae3_handle *handle, int vector) { struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + int vector_id; + + vector_id = hclgevf_get_vector_index(hdev, vector); + if (vector_id < 0) { + dev_err(&handle->pdev->dev, + "hclgevf_put_vector get vector index fail. ret =%d\n", + vector_id); + return vector_id; + } - hclgevf_free_vector(hdev, vector); + hclgevf_free_vector(hdev, vector_id); return 0; } -- 2.7.4