net/i40e: fix out-of-scope variable
PATCH 1/1 net/i40e: fix out-of-scope variable
From: Alvin Zhang <[email protected]>
Using "key", which points to an out-of-scope variable "rss_key_default".
--- drivers/net/i40e/i40e_hash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_hash.c +4 -2
@@ -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); }
Signature · 1 line
1.8.3.1
PATCH v2 1/1 net/i40e: fix out-of-scope variable
From: Alvin Zhang <[email protected]>
Using "key", which points to an out-of-scope variable "rss_key_default".
Coverity issue: 365293
---
V2: Update the commit log.
--- drivers/net/i40e/i40e_hash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_hash.c +4 -2
@@ -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); }
Signature · 1 line
1.8.3.1
Quoted 44 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Zhang,Alvin
Sent: Friday, January 15, 2021 4:34 PM
To: Guo, Jia <[email protected]>; Xie, WeiX <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix out-of-scope variableFrom: Alvin Zhang <[email protected]>
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 <[email protected]>---
V2: Update the commit log.
--- drivers/net/i40e/i40e_hash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/i40e/i40e_hash.c index renamed from drivers/net/i40e/i40e_hash.c +0
-0e07f806..83a9af5 100644
drivers/net/i40e/i40e_hash.c +4
-3@@ -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); } --
Quoted 1 line
1.8.3.1
Zhang, Qi Z
AppliedQuoted 52 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Xing, Beilei
Sent: Monday, January 18, 2021 4:27 PM
To: Zhang, AlvinX <[email protected]>; Guo, Jia <[email protected]>; Xie, WeiX <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix out-of-scope variableQuoted 28 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Zhang,Alvin
Sent: Friday, January 15, 2021 4:34 PM
To: Guo, Jia <[email protected]>; Xie, WeiX <[email protected]>
Cc: [email protected]; Zhang, AlvinX <[email protected]>
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix out-of-scope variableFrom: Alvin Zhang <[email protected]>
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 <[email protected]>---
V2: Update the commit log.
--- drivers/net/i40e/i40e_hash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/net/i40e/i40e_hash.cindex
e07f806..83a9af5 100644drivers/net/i40e/i40e_hash.c struct i40e_hash_match_pattern { · line 902
Quoted 2 lines
drivers/net/i40e/i40e_hash.c +0
-0@@ -901,10 +901,12 @@ struct i40e_hash_match_pattern { PMD_DRV_LOG(WARNING, "RSS key length invalid, must be %u bytes, now set keyto
Quoted 9 lines
drivers/net/i40e/i40e_hash.c +4
-1default", (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)); }
Quoted 7 lines
Quoted 5 lines
drivers/net/i40e/i40e_hash.c +0
-2-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
Acked-by Beilei Xing <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi