[dpdk-dev] app/testpmd: unchecked return value

Message ID 1465986822-22243-1-git-send-email-slawomirx.mrozowicz@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Slawomir Mrozowicz June 15, 2016, 10:33 a.m. UTC
  Calling rte_eth_dev_rss_hash_update without checking return value.
Fixed by handle return value and print out error status.

Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
Coverity ID 119251

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
---
 app/test-pmd/cmdline.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
  

Comments

De Lara Guarch, Pablo June 16, 2016, 8:43 a.m. UTC | #1
> -----Original Message-----
> From: Mrozowicz, SlawomirX
> Sent: Wednesday, June 15, 2016 11:34 AM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org; Mrozowicz, SlawomirX
> Subject: [PATCH] app/testpmd: unchecked return value
> 
> Calling rte_eth_dev_rss_hash_update without checking return value.
> Fixed by handle return value and print out error status.
> 
> Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
> Coverity ID 119251
> 
> Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  
Thomas Monjalon June 16, 2016, 2:48 p.m. UTC | #2
> > Calling rte_eth_dev_rss_hash_update without checking return value.
> > Fixed by handle return value and print out error status.
> > 
> > Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")
> > Coverity ID 119251
> > 
> > Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c5b9479..9616790 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1524,6 +1524,7 @@  cmd_config_rss_parsed(void *parsed_result,
 {
 	struct cmd_config_rss *res = parsed_result;
 	struct rte_eth_rss_conf rss_conf;
+	int diag;
 	uint8_t i;
 
 	if (!strcmp(res->value, "all"))
@@ -1547,8 +1548,13 @@  cmd_config_rss_parsed(void *parsed_result,
 		return;
 	}
 	rss_conf.rss_key = NULL;
-	for (i = 0; i < rte_eth_dev_count(); i++)
-		rte_eth_dev_rss_hash_update(i, &rss_conf);
+	for (i = 0; i < rte_eth_dev_count(); i++) {
+		diag = rte_eth_dev_rss_hash_update(i, &rss_conf);
+		if (diag < 0)
+			printf("Configuration of RSS hash at ethernet port %d "
+				"failed with error (%d): %s.\n",
+				i, -diag, strerror(-diag));
+	}
 }
 
 cmdline_parse_token_string_t cmd_config_rss_port =