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 75C34A0547; Wed, 19 May 2021 10:12:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26CD240041; Wed, 19 May 2021 10:12:01 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id B90574003F; Wed, 19 May 2021 10:11:59 +0200 (CEST) IronPort-SDR: RiG6DM1UJ5FOGfoRCb/myRy+p2wJNyeATpZYcPCNBZ5QJqZ659R1oFCylJLlb2x4HxXl0ky3F2 mTrLf22BnA+w== X-IronPort-AV: E=McAfee;i="6200,9189,9988"; a="264834385" X-IronPort-AV: E=Sophos;i="5.82,312,1613462400"; d="scan'208";a="264834385" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2021 01:11:58 -0700 IronPort-SDR: fhaHwh8AUkpghfpG9kZ0MHbSka7d7dH35zw8Ab9dnFuBeEjT1Pbs87uG0GEoj371/XZg8j822r qf3ZzJdh2hbw== X-IronPort-AV: E=Sophos;i="5.82,312,1613462400"; d="scan'208";a="411636759" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.224.148]) ([10.213.224.148]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2021 01:11:56 -0700 To: Feifei Wang , John Griffin , Fiona Trahe , Deepak Kumar Jain , Jerin Jacob , Herbert Guan Cc: dev@dpdk.org, david.marchand@redhat.com, nd@arm.com, stable@dpdk.org, Ruifeng Wang References: <20210514074113.2666225-1-feifei.wang2@arm.com> <20210517090709.4078-1-feifei.wang2@arm.com> From: Ferruh Yigit X-User: ferruhy Message-ID: Date: Wed, 19 May 2021 09:11:52 +0100 MIME-Version: 1.0 In-Reply-To: <20210517090709.4078-1-feifei.wang2@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3] 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" On 5/17/2021 10:07 AM, Feifei Wang wrote: > 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, How 'digest' is initialized by 'rte_memcpy'? > 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 > --- > v2: add check and free for memory dynamic allocation (David Marchand) > v3: fix compiler error > > drivers/crypto/qat/qat_sym_session.c | 27 ++++++++++++++++++--------- > 1 file changed, 18 insertions(+), 9 deletions(-) > > diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c > index 231b1640da..105a10957a 100644 > --- a/drivers/crypto/qat/qat_sym_session.c > +++ b/drivers/crypto/qat/qat_sym_session.c > @@ -1190,8 +1190,7 @@ 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; Will a memset 'digest' work too? Although not sure which one is better.