[dpdk-dev,2/2] app/testpmd: fix RSS structure initialisation

Message ID 8b28426c813b6811a15ee18d51d44dae748b04c8.1507896510.git.nelio.laranjeiro@6wind.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Nélio Laranjeiro Oct. 13, 2017, 12:09 p.m. UTC
  Struct rss_conf.rss_key_len is not initialised forcing the user to verify
the rss_conf.rss_key pointer to know if the key is present or not.
rss_conf.rss_key_len should have a valid length according to the size of
the rss_key pointed.

Fixes: 560e02ee5237 ("app/testpmd: configure RSS without restart")
Cc: ivan.boule@6wind.com
Cc: stable@dpdk.org

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 app/test-pmd/cmdline.c      | 2 +-
 drivers/net/mlx5/mlx5_rss.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Oct. 20, 2017, 7:46 p.m. UTC | #1
On 10/13/2017 5:09 AM, Nelio Laranjeiro wrote:
> Struct rss_conf.rss_key_len is not initialised forcing the user to verify
> the rss_conf.rss_key pointer to know if the key is present or not.
> rss_conf.rss_key_len should have a valid length according to the size of
> the rss_key pointed.
> 
> Fixes: 560e02ee5237 ("app/testpmd: configure RSS without restart")
> Cc: ivan.boule@6wind.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Yongseok Koh <yskoh@mellanox.com>
> ---
>  app/test-pmd/cmdline.c      | 2 +-
>  drivers/net/mlx5/mlx5_rss.c | 2 +-

Hi Nelio,

Can you please separate test-pmd and driver patch please?

Thanks,
ferruh
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 120460452..abbe52ad6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1750,7 +1750,7 @@  cmd_config_rss_parsed(void *parsed_result,
 			__attribute__((unused)) void *data)
 {
 	struct cmd_config_rss *res = parsed_result;
-	struct rte_eth_rss_conf rss_conf;
+	struct rte_eth_rss_conf rss_conf = { .rss_key_len = 0, };
 	int diag;
 	uint8_t i;
 
diff --git a/drivers/net/mlx5/mlx5_rss.c b/drivers/net/mlx5/mlx5_rss.c
index ad6d9ab70..dd9ddf2e0 100644
--- a/drivers/net/mlx5/mlx5_rss.c
+++ b/drivers/net/mlx5/mlx5_rss.c
@@ -72,7 +72,7 @@  mlx5_rss_hash_update(struct rte_eth_dev *dev,
 	int ret = 0;
 
 	priv_lock(priv);
-	if (rss_conf->rss_key_len) {
+	if (rss_conf->rss_key && rss_conf->rss_key_len) {
 		priv->rss_conf.rss_key = rte_realloc(priv->rss_conf.rss_key,
 						     rss_conf->rss_key_len, 0);
 		if (!priv->rss_conf.rss_key) {