patches for DPDK stable branches
 help / color / mirror / Atom feed
From: wangyunjian <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <cloud.wangxiaoyun@huawei.com>, <zhouguoyang@huawei.com>,
	<xuanziyang2@huawei.com>, <jerry.lilijun@huawei.com>,
	<xudingke@huawei.com>, Yunjian Wang <wangyunjian@huawei.com>,
	<stable@dpdk.org>
Subject: [dpdk-stable] [dpdk-dev] [PATCH] net/hinic: fix negative array index read
Date: Mon, 24 Aug 2020 20:43:46 +0800	[thread overview]
Message-ID: <89aad4deb8394c04209720e79512bee320df2c09.1598250814.git.wangyunjian@huawei.com> (raw)

From: Yunjian Wang <wangyunjian@huawei.com>

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 <wangyunjian@huawei.com>
---
 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,
 						&ethertype_filter);
+		if (i < 0)
+			return -EINVAL;
 
 		if ((filter_info->type_mask & (1 << i))) {
 			filter_info->pkt_filters[i].enable = FALSE;
-- 
2.23.0



             reply	other threads:[~2020-08-24 12:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 12:43 wangyunjian [this message]
2020-08-24 12:54 ` Ferruh Yigit
2020-08-25  9:15   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89aad4deb8394c04209720e79512bee320df2c09.1598250814.git.wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=cloud.wangxiaoyun@huawei.com \
    --cc=dev@dpdk.org \
    --cc=jerry.lilijun@huawei.com \
    --cc=stable@dpdk.org \
    --cc=xuanziyang2@huawei.com \
    --cc=xudingke@huawei.com \
    --cc=zhouguoyang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).