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 8C5D9A0A0C; Fri, 14 May 2021 09:50:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0258F40042; Fri, 14 May 2021 09:50:08 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id BB0FD40041 for ; Fri, 14 May 2021 09:50:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620978605; 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: in-reply-to:in-reply-to:references:references; bh=RtqILjYYAN76rQoxeaTY3PhnJPVTO6PEUpH/h4uGdS8=; b=Rg1Iou9/hVE8MZ+Q8lKNRDbcl9JKNCNbA2+Oxs441gzW1dRr+n0XPAyrmsU9q+UqqpQXwN CILzuUqAuFCRJPPA1HJ/WZgk//RPXGGRwvlDWqDhoqyMI6zdKrokjQmQRvU4n2lQr4FMaA 0Ez3tmKcvEGrmomQmp/85B4QebEOS4Y= Received: from mail-ua1-f69.google.com (mail-ua1-f69.google.com [209.85.222.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-211-wGkuHnRrO6-2DkoGMlU9pQ-1; Fri, 14 May 2021 03:50:03 -0400 X-MC-Unique: wGkuHnRrO6-2DkoGMlU9pQ-1 Received: by mail-ua1-f69.google.com with SMTP id d30-20020ab007de0000b029020e2f98646dso1900622uaf.5 for ; Fri, 14 May 2021 00:50:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RtqILjYYAN76rQoxeaTY3PhnJPVTO6PEUpH/h4uGdS8=; b=AJysay3bQa2kQleE0Oavl3mns10vdlpwKOZQE1LuILBFksGjCICMFJ/CgeXosVG0tU E3Wp7prG++dRmyAbxIoOk46CSqq4pKOr0HOehmHDHojyIUNq61Ne5ZlCeGCs4rRj282c JDGBTj5d0b7enFZVgFTG0FOfdATAPU1gblfsAv26dJe6JccHQvmruhD+fM9bVxtmXMaL eyT1GvK/cZ09sLGOkJt1fYYbRNXB8+r0HzV89xuBo+eGlu1jH79dxT1L61pPFvj72t0Q FZ5k7pMrutFIkFg8Uld52wnY1Mw8qvNbhTlhtkL5EQf1RmdV7qfHJQjUVffYUPAvxzQi Mkrg== X-Gm-Message-State: AOAM530KH6ielTiHYleQt6ISXWloaJozm8TJAcqL6j5bLwLX3TktpzHp RwU1PsYqCJnN4ALEjfUu+GaioyBkdpAQ6HI7YIljtRbUQgIBOYT9i3OO7bGmkBjG8kT7PtqhtU3 tfdcK5olRKt9YmjYR3r8= X-Received: by 2002:ab0:132a:: with SMTP id g39mr11070018uae.53.1620978603129; Fri, 14 May 2021 00:50:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNwa1Fu5ptWvCLmY8j9gtYyVvz3ytscIYrsWUrxeNF7QMWzPQbUT22BUsA1Yw45U5FLo7GYC1NE39lsyN1aNI= X-Received: by 2002:ab0:132a:: with SMTP id g39mr11069999uae.53.1620978602980; Fri, 14 May 2021 00:50:02 -0700 (PDT) MIME-Version: 1.0 References: <20210514074113.2666225-1-feifei.wang2@arm.com> In-Reply-To: <20210514074113.2666225-1-feifei.wang2@arm.com> From: David Marchand Date: Fri, 14 May 2021 09:49:51 +0200 Message-ID: To: Feifei Wang Cc: John Griffin , Fiona Trahe , Deepak Kumar Jain , Herbert Guan , Jerin Jacob , dev , nd , dpdk stable , Ruifeng Wang Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [dpdk-stable] [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" On Fri, May 14, 2021 at 9:41 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 =E2=80=98partial_has= h_compute=E2=80=99: > ../lib/eal/include/generic/rte_byteorder.h:241:24: warning: > =E2=80=98=E2=80=99 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/qa= t_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_aut= h_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 =3D (uint8_t *)calloc(qat_hash_get_digest_size( > + ICP_QAT_HW_AUTH_ALGO_DELIMITER), sizeof(u= int8_t)); calloc can fail. cast is unneded. A simple uint8_t digest[...] =3D { 0 } would do the job. > uint32_t *hash_state_out_be32; > uint64_t *hash_state_out_be64; > int i; > -- > 2.25.1 > --=20 David Marchand