From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5785FA04AC; Mon, 24 Aug 2020 14:44:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D7454F90; Mon, 24 Aug 2020 14:44:09 +0200 (CEST) Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) by dpdk.org (Postfix) with ESMTP id B42DFF72; Mon, 24 Aug 2020 14:44:08 +0200 (CEST) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 9A312859281F396E4A56; Mon, 24 Aug 2020 20:44:03 +0800 (CST) Received: from localhost (10.174.185.168) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Mon, 24 Aug 2020 20:43:53 +0800 From: wangyunjian To: CC: , , , , , Yunjian Wang , Date: Mon, 24 Aug 2020 20:43:46 +0800 Message-ID: <89aad4deb8394c04209720e79512bee320df2c09.1598250814.git.wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.185.168] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] net/hinic: fix negative array index read X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yunjian Wang Negative array index read using variable 'i' as an index to array 'filter_info->pkt_filters'. Fixed by add return value check. Coverity issue: 350364 Fixes: f4ca3fd54c4d ("net/hinic: create and destroy flow director filter") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/net/hinic/hinic_pmd_flow.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c index 503a32fff..70fd4450c 100644 --- a/drivers/net/hinic/hinic_pmd_flow.c +++ b/drivers/net/hinic/hinic_pmd_flow.c @@ -2351,6 +2351,8 @@ hinic_add_del_ethertype_filter(struct rte_eth_dev *dev, ethertype_filter.pkt_proto = filter->ether_type; i = hinic_ethertype_filter_lookup(filter_info, ðertype_filter); + if (i < 0) + return -EINVAL; if ((filter_info->type_mask & (1 << i))) { filter_info->pkt_filters[i].enable = FALSE; -- 2.23.0