DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: fix out-of-scope variable
@ 2021-01-14  6:52 Zhang,Alvin
  2021-01-15  8:34 ` [dpdk-dev] [PATCH v2] " Zhang,Alvin
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang,Alvin @ 2021-01-14  6:52 UTC (permalink / raw)
  To: qi.z.zhang; +Cc: dev, Alvin Zhang

From: Alvin Zhang <alvinx.zhang@intel.com>

Using "key", which points to an out-of-scope variable "rss_key_default".

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
---
 drivers/net/i40e/i40e_hash.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/i40e_hash.c b/drivers/net/i40e/i40e_hash.c
index e07f806..83a9af5 100644
--- a/drivers/net/i40e/i40e_hash.c
+++ b/drivers/net/i40e/i40e_hash.c
@@ -901,10 +901,12 @@ struct i40e_hash_match_pattern {
 			PMD_DRV_LOG(WARNING,
 				    "RSS key length invalid, must be %u bytes, now set key to default",
 				    (uint32_t)sizeof(rss_conf->key));
-		key = (const uint8_t *)rss_key_default;
+
+		memcpy(rss_conf->key, rss_key_default, sizeof(rss_conf->key));
+	} else {
+		memcpy(rss_conf->key, key, sizeof(rss_conf->key));
 	}
 
-	memcpy(rss_conf->key, key, sizeof(rss_conf->key));
 	rss_conf->conf.key = rss_conf->key;
 	rss_conf->conf.key_len = sizeof(rss_conf->key);
 }
-- 
1.8.3.1


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

end of thread, other threads:[~2021-01-19  3:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14  6:52 [dpdk-dev] [PATCH] net/i40e: fix out-of-scope variable Zhang,Alvin
2021-01-15  8:34 ` [dpdk-dev] [PATCH v2] " Zhang,Alvin
2021-01-18  8:27   ` Xing, Beilei
2021-01-19  3:47     ` Zhang, Qi Z

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