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 E0C38A0A0C; Fri, 14 May 2021 09:41:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25D6E410DA; Fri, 14 May 2021 09:41:24 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 3C8A140041; Fri, 14 May 2021 09:41:23 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 761E51476; Fri, 14 May 2021 00:41:22 -0700 (PDT) Received: from net-x86-dell-8268.shanghai.arm.com (net-x86-dell-8268.shanghai.arm.com [10.169.210.127]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 59DAF3F718; Fri, 14 May 2021 00:41:19 -0700 (PDT) From: Feifei Wang To: John Griffin , Fiona Trahe , Deepak Kumar Jain , Herbert Guan , Jerin Jacob Cc: dev@dpdk.org, nd@arm.com, Feifei Wang , stable@dpdk.org, Ruifeng Wang Date: Fri, 14 May 2021 15:41:12 +0800 Message-Id: <20210514074113.2666225-1-feifei.wang2@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] crypto/qat: fix uninitilized compiler warning 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" In Arm platform, when "RTE_ARCH_ARM64_MEMCPY" is set as true, compiler will report variable uninitilized warning: ../drivers/crypto/qat/qat_sym_session.c: In function ‘partial_hash_compute’: ../lib/eal/include/generic/rte_byteorder.h:241:24: warning: ‘’ may be used uninitialized in this function [-Wmaybe-uninitialized] 241 | #define rte_bswap32(x) __builtin_bswap32(x) ... This is because "digest" will be initialized by "rte_memcpy" function rather than "memcpy" if "RTE_ARCH_ARM64_MEMCPY" is set as true. However, compiler cannot know it is initialized by the function. To fix this, use "calloc" to initialize "digest". Fixes: cd7fc8a84b48 ("eal/arm64: optimize memcpy") Cc: stable@dpdk.org Signed-off-by: Feifei Wang Reviewed-by: Ruifeng Wang --- drivers/crypto/qat/qat_sym_session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 231b1640da..dab23a3290 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -1190,8 +1190,8 @@ static int partial_hash_compute(enum icp_qat_hw_auth_algo hash_alg, uint8_t *data_out) { int digest_size; - uint8_t digest[qat_hash_get_digest_size( - ICP_QAT_HW_AUTH_ALGO_DELIMITER)]; + uint8_t *digest = (uint8_t *)calloc(qat_hash_get_digest_size( + ICP_QAT_HW_AUTH_ALGO_DELIMITER), sizeof(uint8_t)); uint32_t *hash_state_out_be32; uint64_t *hash_state_out_be64; int i; -- 2.25.1