From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1ED4E1B163 for ; Mon, 24 Dec 2018 11:30:28 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Dec 2018 02:30:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,391,1539673200"; d="scan'208";a="132483959" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by fmsmga001.fm.intel.com with ESMTP; 24 Dec 2018 02:30:27 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.26]) by IRSMSX154.ger.corp.intel.com ([169.254.12.217]) with mapi id 14.03.0415.000; Mon, 24 Dec 2018 10:30:26 +0000 From: "Dumitrescu, Cristian" To: Stephen Hemminger , Haiyang Tan CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] hash: fix possible uninitialized variable Thread-Index: AQHUme+c0LOhWMVAkU2zCCDV5Fl346WL8p0AgAG+ahA= Date: Mon, 24 Dec 2018 10:30:25 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D891268E818C34@IRSMSX108.ger.corp.intel.com> References: <20181222121100.52827-1-haiyangtan@tencent.com> <20181222234350.789e2a28@xeon-e3> In-Reply-To: <20181222234350.789e2a28@xeon-e3> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGM3OWQyM2YtMjNhNC00NTM5LWJkYzgtMDViMDk1MzU2MWQ5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiR3BvRlJzdktBZk5LUlBnRjRWOEtZUnJ0ZnliQVdZclJTTTBGd1Y0OWRQNjlqbm1Md1N4dFBnR2lDaE5vQklGNSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] hash: fix possible uninitialized variable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Dec 2018 10:30:29 -0000 > -----Original Message----- > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Sunday, December 23, 2018 7:44 AM > To: Haiyang Tan > Cc: Dumitrescu, Cristian ; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] hash: fix possible uninitialized variable >=20 > On Sat, 22 Dec 2018 04:10:59 -0800 > Haiyang Tan wrote: >=20 > > 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 >=20 > This is not necessary. Structure initializations will fill in the other > elements with zero. >=20 > https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Designated-Inits.html > Omitted field members are implicitly initialized the same as objects th= at > 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, b= ut 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 yo= u think? struct rte_hash_parameters hash_cuckoo_params =3D { ... .extra_flag =3D 0, }; Regards, Cristian