DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Trivial fixes for Coverity warnings
@ 2015-12-08 16:51 Stephen Hemminger
  2015-12-08 16:51 ` [dpdk-dev] [PATCH 1/2] ip_pipeline: fix coverity warning Stephen Hemminger
  2015-12-08 16:51 ` [dpdk-dev] [PATCH 2/2] ethtool: fix dead code Stephen Hemminger
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-12-08 16:51 UTC (permalink / raw)
  To: dev

Fix the low hanging fruit.

Stephen Hemminger (2):
  ip_pipeline: fix coverity warning
  ethtool: fix dead code

 examples/ethtool/ethtool-app/ethapp.c | 9 +++------
 examples/ip_pipeline/thread_fe.c      | 5 ++---
 2 files changed, 5 insertions(+), 9 deletions(-)

-- 
2.1.4

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

* [dpdk-dev] [PATCH 1/2] ip_pipeline: fix coverity warning
  2015-12-08 16:51 [dpdk-dev] [PATCH 0/2] Trivial fixes for Coverity warnings Stephen Hemminger
@ 2015-12-08 16:51 ` Stephen Hemminger
  2015-12-08 16:51 ` [dpdk-dev] [PATCH 2/2] ethtool: fix dead code Stephen Hemminger
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2015-12-08 16:51 UTC (permalink / raw)
  To: dev

Fix problem reported by latest Coverity scan.
It won't have a direct impact on anything.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

** CID 120412:  Code maintainability issues  (SIZEOF_MISMATCH)
/examples/ip_pipeline/thread_fe.c: 338 in app_pipeline_thread_cmd_push()

*** CID 120412:  Code maintainability issues  (SIZEOF_MISMATCH)
/examples/ip_pipeline/thread_fe.c: 338 in app_pipeline_thread_cmd_push()
332     	/* Check for available slots in the application commands array */
333     	n_cmds = RTE_DIM(thread_cmds) - 1;
334     	if (n_cmds > APP_MAX_CMDS - app->n_cmds)
335     		return -ENOMEM;
336
337     	/* Push thread commands into the application */
>>>     CID 120412:  Code maintainability issues  (SIZEOF_MISMATCH)
>>>     Passing argument "&app->cmds[app->n_cmds]" of type "cmdline_parse_ctx_t *" and argument "n_cmds * 8UL /* sizeof (cmdline_parse_ctx_t *) */" to function "memcpy" is suspicious. In this case, "sizeof (cmdline_parse_ctx_t *)" is equal to "sizeof (cmdline_parse_ctx_t)", but this is not a portable assumption.
338     	memcpy(&app->cmds[app->n_cmds],
339     			thread_cmds,
340     		n_cmds * sizeof(cmdline_parse_ctx_t *));
341
342     	for (i = 0; i < n_cmds; i++)
343     		app->cmds[app->n_cmds + i]->data = app;
---
 examples/ip_pipeline/thread_fe.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/examples/ip_pipeline/thread_fe.c b/examples/ip_pipeline/thread_fe.c
index 7a3bbf8..95f0107 100644
--- a/examples/ip_pipeline/thread_fe.c
+++ b/examples/ip_pipeline/thread_fe.c
@@ -335,9 +335,8 @@ app_pipeline_thread_cmd_push(struct app_params *app)
 		return -ENOMEM;
 
 	/* Push thread commands into the application */
-	memcpy(&app->cmds[app->n_cmds],
-			thread_cmds,
-		n_cmds * sizeof(cmdline_parse_ctx_t *));
+	memcpy(&app->cmds[app->n_cmds], thread_cmds,
+		n_cmds * sizeof(cmdline_parse_ctx_t));
 
 	for (i = 0; i < n_cmds; i++)
 		app->cmds[app->n_cmds + i]->data = app;
-- 
2.1.4

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

* [dpdk-dev] [PATCH 2/2] ethtool: fix dead code
  2015-12-08 16:51 [dpdk-dev] [PATCH 0/2] Trivial fixes for Coverity warnings Stephen Hemminger
  2015-12-08 16:51 ` [dpdk-dev] [PATCH 1/2] ip_pipeline: fix coverity warning Stephen Hemminger
@ 2015-12-08 16:51 ` Stephen Hemminger
  2015-12-08 16:58   ` Remy Horton
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2015-12-08 16:51 UTC (permalink / raw)
  To: dev

Remove dead code, and print better return for other errors.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

*** CID 120411:  Control flow issues  (DEADCODE)
/examples/ethtool/ethtool-app/ethapp.c: 484 in pcmd_macaddr_callback()
478     				mac_addr.addr_bytes[4],
479     				mac_addr.addr_bytes[5]);
480     			return;
481     		}
482     	}
483     	if (stat == 0)
>>>     CID 120411:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "return;".
484     		return;
485     	else if (stat == -ENOTSUP)
486     		printf("Port %i: Operation not supported\n", params->port);
487     	else
488     		printf("Port %i: Error %i\n", params->port, stat);
489     }

** CID 120410:  Error handling issues  (CHECKED_RETURN)
---
 examples/ethtool/ethtool-app/ethapp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c
index 57c584e..3863b02 100644
--- a/examples/ethtool/ethtool-app/ethapp.c
+++ b/examples/ethtool/ethtool-app/ethapp.c
@@ -480,12 +480,9 @@ pcmd_macaddr_callback(void *ptr_params,
 			return;
 		}
 	}
-	if (stat == 0)
-		return;
-	else if (stat == -ENOTSUP)
-		printf("Port %i: Operation not supported\n", params->port);
-	else
-		printf("Port %i: Error %i\n", params->port, stat);
+
+	printf("Port %i: Error %s\n", params->port,
+	       strerror(-stat));
 }
 
 static void
-- 
2.1.4

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

* Re: [dpdk-dev] [PATCH 2/2] ethtool: fix dead code
  2015-12-08 16:51 ` [dpdk-dev] [PATCH 2/2] ethtool: fix dead code Stephen Hemminger
@ 2015-12-08 16:58   ` Remy Horton
  2015-12-09 20:36     ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Remy Horton @ 2015-12-08 16:58 UTC (permalink / raw)
  To: dev

Beat me to it.. :)

On 08/12/2015 16:51, Stephen Hemminger wrote:
> Remove dead code, and print better return for other errors.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Remy Horton <remy.horton@intel.com>

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

* Re: [dpdk-dev] [PATCH 2/2] ethtool: fix dead code
  2015-12-08 16:58   ` Remy Horton
@ 2015-12-09 20:36     ` Thomas Monjalon
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2015-12-09 20:36 UTC (permalink / raw)
  To: stephen; +Cc: dev

2015-12-08 16:58, Remy Horton:
> Beat me to it.. :)
> 
> On 08/12/2015 16:51, Stephen Hemminger wrote:
> > Remove dead code, and print better return for other errors.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> Acked-by: Remy Horton <remy.horton@intel.com>

Series applied, thanks

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

end of thread, other threads:[~2015-12-09 20:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08 16:51 [dpdk-dev] [PATCH 0/2] Trivial fixes for Coverity warnings Stephen Hemminger
2015-12-08 16:51 ` [dpdk-dev] [PATCH 1/2] ip_pipeline: fix coverity warning Stephen Hemminger
2015-12-08 16:51 ` [dpdk-dev] [PATCH 2/2] ethtool: fix dead code Stephen Hemminger
2015-12-08 16:58   ` Remy Horton
2015-12-09 20:36     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).