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

* [dpdk-dev] [PATCH v2] net/i40e: fix out-of-scope variable
  2021-01-14  6:52 [dpdk-dev] [PATCH] net/i40e: fix out-of-scope variable Zhang,Alvin
@ 2021-01-15  8:34 ` Zhang,Alvin
  2021-01-18  8:27   ` Xing, Beilei
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang,Alvin @ 2021-01-15  8:34 UTC (permalink / raw)
  To: jia.guo, WeiX.Xie; +Cc: dev, Alvin Zhang

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

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 <alvinx.zhang@intel.com>
---

V2: Update the commit log.
---
 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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix out-of-scope variable
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Xing, Beilei @ 2021-01-18  8:27 UTC (permalink / raw)
  To: Zhang, AlvinX, Guo, Jia, Xie, WeiX; +Cc: dev, Zhang, AlvinX



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Zhang,Alvin
> Sent: Friday, January 15, 2021 4:34 PM
> To: Guo, Jia <jia.guo@intel.com>; Xie, WeiX <weix.xie@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>
> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix out-of-scope variable
> 
> From: Alvin Zhang <alvinx.zhang@intel.com>
> 
> 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 <alvinx.zhang@intel.com>
> ---
> 
> V2: Update the commit log.
> ---
>  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

Acked-by: Beilei Xing <beilei.xing@intel.com>


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

* Re: [dpdk-dev] [PATCH v2] net/i40e: fix out-of-scope variable
  2021-01-18  8:27   ` Xing, Beilei
@ 2021-01-19  3:47     ` Zhang, Qi Z
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2021-01-19  3:47 UTC (permalink / raw)
  To: Xing, Beilei, Zhang, AlvinX, Guo, Jia, Xie, WeiX; +Cc: dev, Zhang, AlvinX



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xing, Beilei
> Sent: Monday, January 18, 2021 4:27 PM
> To: Zhang, AlvinX <alvinx.zhang@intel.com>; Guo, Jia <jia.guo@intel.com>; Xie,
> WeiX <weix.xie@intel.com>
> Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>
> Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: fix out-of-scope variable
> 
> 
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Zhang,Alvin
> > Sent: Friday, January 15, 2021 4:34 PM
> > To: Guo, Jia <jia.guo@intel.com>; Xie, WeiX <weix.xie@intel.com>
> > Cc: dev@dpdk.org; Zhang, AlvinX <alvinx.zhang@intel.com>
> > Subject: [dpdk-dev] [PATCH v2] net/i40e: fix out-of-scope variable
> >
> > From: Alvin Zhang <alvinx.zhang@intel.com>
> >
> > 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 <alvinx.zhang@intel.com>
> > ---
> >
> > V2: Update the commit log.
> > ---
> >  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
> 
> Acked-by: Beilei Xing <beilei.xing@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi

^ 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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git