From: Yunjian Wang Date: Mon, 24 Aug 2020 12:43:46 +0000 (+0800) Subject: net/hinic: fix negative array index read X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2e8fb3d2442cc0123562d4c43a6e86a1bb3df62f;p=dpdk.git net/hinic: fix negative array index read 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 Reviewed-by: Ferruh Yigit --- diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c index 503a32fff0..70fd4450c2 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;