patches for DPDK stable branches
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Feifei Wang <feifei.wang2@arm.com>
Cc: John Griffin <john.griffin@intel.com>,
	Fiona Trahe <fiona.trahe@intel.com>,
	Deepak Kumar Jain <deepak.k.jain@intel.com>,
	Herbert Guan <herbert.guan@arm.com>,
	 Jerin Jacob <jerin.jacob@caviumnetworks.com>, dev <dev@dpdk.org>,
	nd <nd@arm.com>,  dpdk stable <stable@dpdk.org>,
	Ruifeng Wang <ruifeng.wang@arm.com>
Subject: Re: [dpdk-stable] [PATCH] crypto/qat: fix uninitilized compiler warning
Date: Fri, 14 May 2021 09:49:51 +0200
Message-ID: <CAJFAV8wCqkOvyJ87sDksVSuD55U8kjZgEPAdE0q26VaDr2Na_A@mail.gmail.com> (raw)
In-Reply-To: <20210514074113.2666225-1-feifei.wang2@arm.com>

On Fri, May 14, 2021 at 9:41 AM Feifei Wang <feifei.wang2@arm.com> 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:
> ‘<U35a0>’ 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 <feifei.wang2@arm.com>
> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> ---
>  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));

calloc can fail.
cast is unneded.

A simple uint8_t digest[...] = { 0 } would do the job.


>         uint32_t *hash_state_out_be32;
>         uint64_t *hash_state_out_be64;
>         int i;
> --
> 2.25.1
>



-- 
David Marchand


  reply	other threads:[~2021-05-14  7:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14  7:41 Feifei Wang
2021-05-14  7:49 ` David Marchand [this message]
2021-05-14  8:01   ` [dpdk-stable] 回复: " Feifei Wang
2021-05-14  8:13     ` [dpdk-stable] " David Marchand
2021-05-14  8:30       ` [dpdk-stable] 回复: " Feifei Wang
2021-05-17  9:07 ` [dpdk-stable] [PATCH v3] " Feifei Wang
2021-05-19  7:56   ` Thomas Monjalon
2021-05-19  8:11   ` Ferruh Yigit
2021-05-20  5:44     ` [dpdk-stable] 回复: " Feifei Wang
2021-05-20  8:08       ` Ferruh Yigit
2021-05-19 13:13   ` [dpdk-stable] [dpdk-dev] " Dybkowski, AdamX
2021-05-19 13:16   ` Dybkowski, AdamX
2021-05-20  5:47     ` [dpdk-stable] 回复: " Feifei Wang
2021-05-20  8:43 ` [dpdk-stable] [PATCH v4] crypto/qat: fix uninitilized gcc " Feifei Wang
2021-05-20  9:06   ` Dybkowski, AdamX
2021-05-21  2:00 ` [dpdk-stable] [PATCH v5] crypto/qat: fix uninitialized " Feifei Wang
2021-06-29 20:04   ` [dpdk-stable] [EXT] [dpdk-dev] " Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJFAV8wCqkOvyJ87sDksVSuD55U8kjZgEPAdE0q26VaDr2Na_A@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=feifei.wang2@arm.com \
    --cc=fiona.trahe@intel.com \
    --cc=herbert.guan@arm.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=john.griffin@intel.com \
    --cc=nd@arm.com \
    --cc=ruifeng.wang@arm.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git