From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 66219A0A0C; Fri, 14 May 2021 17:08:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE06A40042; Fri, 14 May 2021 17:08:51 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 240FC40041 for ; Fri, 14 May 2021 17:08:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621004929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pnvNPz9a2NNVqyxLEO/LNHHN4+gvqjiBLd7fAlJBSuU=; b=SbCsEstkOnV7hxLtzlYMG4cMAB+q9vsO0t5V1Sw9i8rabENTdmzq28L+wCIalQsCbDtDq+ KLM/Io3uyYqpirYOZJ1PBoeXbjnEpqKSPH6yfzwkpEsr+JX1jIbH+w/6wJkX5U8eCq9qJF Tqnf7rDwObrrOVMKDZk1rDPg8dFfSNs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-168-lnQ4dHq8OpOKNkJ00ch_bQ-1; Fri, 14 May 2021 11:08:47 -0400 X-MC-Unique: lnQ4dHq8OpOKNkJ00ch_bQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F1715801106; Fri, 14 May 2021 15:08:46 +0000 (UTC) Received: from rh.Home (ovpn-114-205.ams2.redhat.com [10.36.114.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FABE19EF2; Fri, 14 May 2021 15:08:45 +0000 (UTC) From: Kevin Traynor To: dev@dpdk.org Cc: gakhil@marvell.com, ferruh.yigit@intel.com, Kevin Traynor , Pablo de Lara Date: Fri, 14 May 2021 16:08:34 +0100 Message-Id: <20210514150834.227474-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] crypto/zuc: fix gcc11 maybe-uninitialized warnings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" gcc11 complains that some arrays may be uninitialized in process_zuc_hash_op(). This is because their initialization depends on num_ops being > 0. For example: $ gcc --version gcc (GCC) 11.1.1 20210428 (Red Hat 11.1.1-1) In file included from ../drivers/crypto/zuc/zuc_pmd_private.h:8, from ../drivers/crypto/zuc/rte_zuc_pmd.c:13: ../drivers/crypto/zuc/rte_zuc_pmd.c: In function ‘process_zuc_hash_op’: ../drivers/crypto/zuc/rte_zuc_pmd.c:279:33: error: ‘hash_keys’ may be used uninitialized [-Werror=maybe-uninitialized] 279 | IMB_ZUC_EIA3_N_BUFFER(qp->mb_mgr, (const void **)hash_keys, | ^ ../drivers/crypto/zuc/rte_zuc_pmd.c:279:33: note: by argument 1 of type ‘const void * const*’ to ‘void(const void * const*, const void * const*, const void * const*, const uint32_t *, uint32_t **, const uint32_t)’ {aka ‘void(const void * const*, const void * const*, const void * const*, const unsigned int *, unsigned int **, const unsigned int)’} ../drivers/crypto/zuc/rte_zuc_pmd.c:245:21: note: ‘hash_keys’ declared here 245 | const void *hash_keys[ZUC_MAX_BURST]; | ^~~~~~~~~ This function is only called with num_ops > 0 because of checks in process_zuc_hash_op(). To remove the warning initialize the arrays. Signed-off-by: Kevin Traynor --- drivers/crypto/zuc/rte_zuc_pmd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c index aa50c12da6..42b669f188 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd.c +++ b/drivers/crypto/zuc/rte_zuc_pmd.c @@ -239,9 +239,9 @@ process_zuc_hash_op(struct zuc_qp *qp, struct rte_crypto_op **ops, unsigned int i; uint8_t processed_ops = 0; - uint8_t *src[ZUC_MAX_BURST]; + uint8_t *src[ZUC_MAX_BURST] = { 0 }; uint32_t *dst[ZUC_MAX_BURST]; - uint32_t length_in_bits[ZUC_MAX_BURST]; - uint8_t *iv[ZUC_MAX_BURST]; - const void *hash_keys[ZUC_MAX_BURST]; + uint32_t length_in_bits[ZUC_MAX_BURST] = { 0 }; + uint8_t *iv[ZUC_MAX_BURST] = { 0 }; + const void *hash_keys[ZUC_MAX_BURST] = { 0 }; struct zuc_session *sess; -- 2.31.1