DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	Haiyang Tan <haiyangtan@tencent.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] hash: fix possible uninitialized variable
Date: Mon, 24 Dec 2018 10:30:25 +0000	[thread overview]
Message-ID: <3EB4FA525960D640B5BDFFD6A3D891268E818C34@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <20181222234350.789e2a28@xeon-e3>



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Sunday, December 23, 2018 7:44 AM
> To: Haiyang Tan <haiyangtan@tencent.com>
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] hash: fix possible uninitialized variable
> 
> On Sat, 22 Dec 2018 04:10:59 -0800
> Haiyang Tan <haiyangtan@tencent.com> wrote:
> 
> > The uninitialized field 'extra_flag' of hash_cuckoo_params may enable
> > certain feature silently. Typically, if bit0 of 'extra_flag' set, the
> > hardware transactional memory support will be enabled unexpectedly.
> >
> > Signed-off-by: Haiyang Tan <haiyangtan@tencent.com>
> 
> This is not necessary. Structure initializations will fill in the other
> elements with zero.
> 
> https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Designated-Inits.html
>   Omitted field members are implicitly initialized the same as objects that
> have static storage duration.

Agree with Stephen, this is part of the C language.

Haiyang, are you experiencing a real issue in your app or is your proposal triggered purely by code review?

Haiyang, it seems that the extra_flags was recently added in librte_hash, but left behind in librte_table. For better readability, I suggest you send a quick patch that explicitly initializes the extra_flag with 0, what do you think?

	struct rte_hash_parameters hash_cuckoo_params = {
		...
		.extra_flag = 0,
	};

Regards,
Cristian

      reply	other threads:[~2018-12-24 10:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-22 12:10 Haiyang Tan
2018-12-23  7:43 ` Stephen Hemminger
2018-12-24 10:30   ` Dumitrescu, Cristian [this message]

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=3EB4FA525960D640B5BDFFD6A3D891268E818C34@IRSMSX108.ger.corp.intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=haiyangtan@tencent.com \
    --cc=stephen@networkplumber.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).