[dpdk-dev] [PATCH] app/test-compress-perf: fix reliance on integer endianness (CI:328524)

Artur Trybula arturx.trybula at intel.com
Mon Jun 3 15:50:46 CEST 2019


This patch fixes Coverity Issue 328524:
Reliance on integer endianness (INCOMPATIBLE_CAST) in function *parse_window_sz*.

Signed-off-by: Artur Trybula <arturx.trybula at intel.com>
---
 app/test-compress-perf/comp_perf_options_parse.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c
index 2fb6fb48a..a7a8c1f9e 100644
--- a/app/test-compress-perf/comp_perf_options_parse.c
+++ b/app/test-compress-perf/comp_perf_options_parse.c
@@ -364,12 +364,14 @@ parse_max_num_sgl_segs(struct comp_test_data *test_data, const char *arg)
 static int
 parse_window_sz(struct comp_test_data *test_data, const char *arg)
 {
-	int ret = parse_uint16_t((uint16_t *)&test_data->window_sz, arg);
+	uint16_t tmp;
+	int ret = parse_uint16_t(&tmp, arg);
 
 	if (ret) {
 		RTE_LOG(ERR, USER1, "Failed to parse window size\n");
 		return -1;
 	}
+	test_data->window_sz = (int)tmp;
 
 	return 0;
 }
-- 
2.17.1



More information about the dev mailing list