From: Alvin Zhang Date: Fri, 15 Jan 2021 08:34:11 +0000 (+0800) Subject: net/i40e: fix out of scope variable X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=52a6478257b26b0eada505d815790c83280be27a;p=dpdk.git net/i40e: fix out of scope variable Using "key", which points to an out-of-scope variable "rss_key_default". Coverity issue: 365293 Fixes: ef4c16fd9148 ("net/i40e: refactor RSS flow") Signed-off-by: Alvin Zhang Acked-by: Beilei Xing --- diff --git a/drivers/net/i40e/i40e_hash.c b/drivers/net/i40e/i40e_hash.c index ae861ab4ff..9271797a77 100644 --- a/drivers/net/i40e/i40e_hash.c +++ b/drivers/net/i40e/i40e_hash.c @@ -903,10 +903,12 @@ i40e_hash_parse_key(const struct rte_flow_action_rss *rss_act, 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); }