diff mbox series

net/i40e: fix out-of-scope variable

Message ID 20210114065248.17160-1-alvinx.zhang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers show
Series net/i40e: fix out-of-scope variable | expand

Checks

Context Check Description
ci/iol-testing warning Testing issues
ci/iol-testing warning Testing issues
ci/iol-abi-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Alvin Zhang Jan. 14, 2021, 6:52 a.m. UTC
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 mbox series

Patch

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);
 }