patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/virtio: fix uninitialized old_rss_key variable
@ 2022-01-08  8:14 Yunjian Wang
  2022-01-14  7:14 ` Xia, Chenbo
  2022-01-27  5:29 ` Xia, Chenbo
  0 siblings, 2 replies; 3+ messages in thread
From: Yunjian Wang @ 2022-01-08  8:14 UTC (permalink / raw)
  To: dev
  Cc: maxime.coquelin, chenbo.xia, dingxiaoxiong, xudingke,
	Yunjian Wang, stable

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [dpdk-dev] [PATCH] net/virtio: fix uninitialized old_rss_key variable
  2022-01-08  8:14 [dpdk-dev] [PATCH] net/virtio: fix uninitialized old_rss_key variable Yunjian Wang
@ 2022-01-14  7:14 ` Xia, Chenbo
  2022-01-27  5:29 ` Xia, Chenbo
  1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2022-01-14  7:14 UTC (permalink / raw)
  To: Yunjian Wang, dev; +Cc: maxime.coquelin, dingxiaoxiong, xudingke, stable

Hi Yunjuan,

> -----Original Message-----
> From: Yunjian Wang <wangyunjian@huawei.com>
> Sent: Saturday, January 8, 2022 4:14 PM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Xia, Chenbo <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
> 
> 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

Appreciate your effort with Coverity issue, thanks!

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [dpdk-dev] [PATCH] net/virtio: fix uninitialized old_rss_key variable
  2022-01-08  8:14 [dpdk-dev] [PATCH] net/virtio: fix uninitialized old_rss_key variable Yunjian Wang
  2022-01-14  7:14 ` Xia, Chenbo
@ 2022-01-27  5:29 ` Xia, Chenbo
  1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2022-01-27  5:29 UTC (permalink / raw)
  To: Yunjian Wang, dev; +Cc: maxime.coquelin, dingxiaoxiong, xudingke, stable

> -----Original Message-----
> From: Yunjian Wang <wangyunjian@huawei.com>
> Sent: Saturday, January 8, 2022 4:14 PM
> To: dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Xia, Chenbo <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
> 
> 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

Applied to next-virtio/main with headline fixed, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-27  5:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-08  8:14 [dpdk-dev] [PATCH] net/virtio: fix uninitialized old_rss_key variable Yunjian Wang
2022-01-14  7:14 ` Xia, Chenbo
2022-01-27  5:29 ` Xia, Chenbo

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).