From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 79F8DA0350; Sat, 8 Jan 2022 09:14:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EBC240696; Sat, 8 Jan 2022 09:14:27 +0100 (CET) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 33D3B40042; Sat, 8 Jan 2022 09:14:25 +0100 (CET) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4JWCV864l8z5HpD; Sat, 8 Jan 2022 16:11:44 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 8 Jan 2022 16:14:23 +0800 Received: from localhost (10.174.242.157) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sat, 8 Jan 2022 16:14:22 +0800 From: Yunjian Wang To: CC: , , , , Yunjian Wang , Subject: [dpdk-dev] [PATCH] net/virtio: fix uninitialized old_rss_key variable Date: Sat, 8 Jan 2022 16:14:21 +0800 Message-ID: <59c1e579917d1ddeeb80c553021a1d551ddb9b52.1641629424.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.242.157] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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