From patchwork Mon Sep 11 15:13:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 28594 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 43FF51B1EE; Mon, 11 Sep 2017 17:14:05 +0200 (CEST) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 124276D45 for ; Mon, 11 Sep 2017 17:13:52 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 1A54BCF332 for ; Mon, 11 Sep 2017 17:09:58 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Date: Mon, 11 Sep 2017 17:13:33 +0200 Message-Id: <20170911151333.5727-11-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170911151333.5727-1-olivier.matz@6wind.com> References: <20170911151333.5727-1-olivier.matz@6wind.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 10/10] app/test-crypto-perf: fix compilation with -Og X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The compilation with gcc-6.3.0 and EXTRA_CFLAGS=-Og gives the following error: CC cperf_test_verify.o cperf_test_verify.c: In function ‘cperf_verify_op’: cperf_test_verify.c:382:5: error: ‘auth’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if (auth == 1) { ^ cperf_test_verify.c:371:5: error: ‘cipher’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if (cipher == 1) { ^ cperf_test_verify.c:384:11: error: ‘auth_offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized] res += memcmp(data + auth_offset, ^~~~~~~~~~~~~~~~~~~~~~~~~~ vector->digest.data, ~~~~~~~~~~~~~~~~~~~~ options->digest_sz); ~~~~~~~~~~~~~~~~~~~ cperf_test_verify.c:377:11: error: ‘cipher_offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized] res += memcmp(data + cipher_offset, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ vector->plaintext.data, ~~~~~~~~~~~~~~~~~~~~~~~ options->test_buffer_size); ~~~~~~~~~~~~~~~~~~~~~~~~~~ There is no default case in the switch statement, so if options->op_type is an unknown value, the function will use uninitialized values. Fix it by adding a default. Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application") Signed-off-by: Olivier Matz Acked-by: Pablo de Lara --- app/test-crypto-perf/cperf_test_verify.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index 5221f2251..36be7b864 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -366,6 +366,9 @@ cperf_verify_op(struct rte_crypto_op *op, auth = 1; auth_offset = vector->aad.length + options->test_buffer_size; break; + default: + res = 1; + goto out; } if (cipher == 1) { @@ -386,6 +389,7 @@ cperf_verify_op(struct rte_crypto_op *op, options->digest_sz); } +out: rte_free(data); return !!res; }