DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yunjian Wang <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <maxime.coquelin@redhat.com>, <chenbo.xia@intel.com>,
	<dingxiaoxiong@huawei.com>, <xudingke@huawei.com>,
	Yunjian Wang <wangyunjian@huawei.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/virtio: fix uninitialized old_rss_key variable
Date: Sat, 8 Jan 2022 16:14:21 +0800	[thread overview]
Message-ID: <59c1e579917d1ddeeb80c553021a1d551ddb9b52.1641629424.git.wangyunjian@huawei.com> (raw)

This patch fixes an issue that uninitialized old_rss_key
is used for restoring the rss_key.

Coverity issue: 373866
Fixes: 0c9d66207054 ("net/virtio: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/virtio/virtio_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index c2588369b2..7c445bfc48 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2028,7 +2028,8 @@ virtio_dev_rss_hash_update(struct rte_eth_dev *dev,
 
 	return 0;
 restore_key:
-	memcpy(hw->rss_key, old_rss_key, VIRTIO_NET_RSS_KEY_SIZE);
+	if (rss_conf->rss_key && rss_conf->rss_key_len)
+		memcpy(hw->rss_key, old_rss_key, VIRTIO_NET_RSS_KEY_SIZE);
 restore_types:
 	hw->rss_hash_types = old_hash_types;
 
-- 
2.27.0


             reply	other threads:[~2022-01-08  8:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-08  8:14 Yunjian Wang [this message]
2022-01-14  7:14 ` Xia, Chenbo
2022-01-27  5:29 ` Xia, Chenbo

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=59c1e579917d1ddeeb80c553021a1d551ddb9b52.1641629424.git.wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=dingxiaoxiong@huawei.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=xudingke@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).