patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Feifei Wang <Feifei.Wang2@arm.com>
To: David Marchand <david.marchand@redhat.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>, nd <nd@arm.com>
Subject: [dpdk-stable] 回复:  [PATCH] crypto/qat: fix uninitilized compiler warning
Date: Fri, 14 May 2021 08:30:18 +0000
Message-ID: <DB9PR08MB69234FB79D60155EDA4BBF67C8509@DB9PR08MB6923.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <CAJFAV8yG5nkAXBfnF_SCvjKGCZQoe4MWH93=YbK9QXkO+yruVA@mail.gmail.com>

> -----邮件原件-----
> 发件人: David Marchand <david.marchand@redhat.com>
> 发送时间: 2021年5月14日 16:14
> 收件人: Feifei Wang <Feifei.Wang2@arm.com>
> 抄送: 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>
> 主题: Re: [dpdk-stable] [PATCH] crypto/qat: fix uninitilized compiler warning
> 
> On Fri, May 14, 2021 at 10:01 AM Feifei Wang <Feifei.Wang2@arm.com>
> wrote:
> > > > @@ -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.
> >
> > Thanks for your comment. Actually, we have tried to use this simple
> method:
> >  uint8_t
> > digest[qat_hash_get_digest_size(ICP_QAT_HW_AUTH_ALGO_DELIMITER)]
> =
> > {0};
> >
> > And it will report compile error:
> > ../drivers/crypto/qat/qat_sym_session.c:1194:4: error: variable-sized
> object may not be initialized
> >  1194 |    ICP_QAT_HW_AUTH_ALGO_DELIMITER)] = {0};
> >       |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ../drivers/crypto/qat/qat_sym_session.c:1194:40: warning: excess
> elements in array initializer
> >  1194 |    ICP_QAT_HW_AUTH_ALGO_DELIMITER)] = {0};
> >       |                                        ^
> > ../drivers/crypto/qat/qat_sym_session.c:1194:40: note: (near
> > initialization for ‘digest’)
> > ninja: build stopped: subcommand failed.
> >
> > I think this is because compiler cannot know the size of digest due to
> > function 'qat_hash_get_digest_size' during  compiling time.
> 
> Ok, I had not noticed the function call.
> 
> Please check dynamic allocation succeeds.
> + free this temp buffer before leaving this helper function.

Thanks for this comments, I will add check and free operations for this dynamic allocation
in the next version

Best Regards
Feifei 
> 
> 
> --
> David marchand


  reply	other threads:[~2021-05-14  8:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14  7:41 [dpdk-stable] " Feifei Wang
2021-05-14  7:49 ` David Marchand
2021-05-14  8:01   ` [dpdk-stable] 回复: " Feifei Wang
2021-05-14  8:13     ` [dpdk-stable] " David Marchand
2021-05-14  8:30       ` Feifei Wang [this message]
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=DB9PR08MB69234FB79D60155EDA4BBF67C8509@DB9PR08MB6923.eurprd08.prod.outlook.com \
    --to=feifei.wang2@arm.com \
    --cc=Herbert.Guan@arm.com \
    --cc=Ruifeng.Wang@arm.com \
    --cc=david.marchand@redhat.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=john.griffin@intel.com \
    --cc=nd@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