examples/ip_pipeline: fix coverity warnings
authorPiotr Azarewicz <piotrx.t.azarewicz@intel.com>
Wed, 9 Dec 2015 09:33:50 +0000 (10:33 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 9 Dec 2015 21:02:33 +0000 (22:02 +0100)
commit2d8d97b734d3a921be3f12454f04e557bdc4fa94
tree4825aa3901e25a921f0c2b43f5f535086a1aa560
parent94cb97a03999dda5ccbc89b8f96c51bcfc677c5c
examples/ip_pipeline: fix coverity warnings

The source and destination both are the arrays of cmdline_parse_ctx_t.
So the goal is to copy elements size of cmdline_parse_ctx_t not
cmdline_parse_ctx_t*.

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.

Coverity issue: 120412
Fixes: b4aee0fb9c6d ("examples/ip_pipeline: reconfigure thread binding dynamically")
Fixes: ea0908c4ab89 ("examples/ip_pipeline: add master pipeline")
Fixes: eb32fe7c5574 ("examples/ip_pipeline: rework initialization parameters")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
examples/ip_pipeline/init.c
examples/ip_pipeline/pipeline/pipeline_common_fe.c
examples/ip_pipeline/thread_fe.c