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 E89513989 for ; Mon, 30 Jan 2017 13:26:50 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP; 30 Jan 2017 04:26:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,311,1477983600"; d="scan'208";a="58800233" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga005.jf.intel.com with ESMTP; 30 Jan 2017 04:26:48 -0800 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by IRSMSX106.ger.corp.intel.com (163.33.3.31) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 30 Jan 2017 12:26:48 +0000 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.173]) by irsmsx155.ger.corp.intel.com ([169.254.14.204]) with mapi id 14.03.0248.002; Mon, 30 Jan 2017 12:26:47 +0000 From: "De Lara Guarch, Pablo" To: Adrien Mazarguil CC: "Wu, Jingjing" , "dev@dpdk.org" Thread-Topic: [PATCH v2] app/testpmd: fix memory leak Thread-Index: AQHSetvsxP4CwA5ySUOQ+XUsgzd2WKFQ8heQ Date: Mon, 30 Jan 2017 12:26:47 +0000 Message-ID: References: <1485522948-210951-1-git-send-email-pablo.de.lara.guarch@intel.com> <1485528898-53283-1-git-send-email-pablo.de.lara.guarch@intel.com> <20170130093318.GB10133@6wind.com> In-Reply-To: <20170130093318.GB10133@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMWVhMWIwNTUtNzhhZC00NjhmLTljNTItZDU4ZTcwM2YwZjljIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlVacEpOWjByTklubmdvSkc4d2h4SjgrWktXdFBaNGdRRkFLVmxncUJSbEU9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] app/testpmd: fix memory leak 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, 30 Jan 2017 12:26:51 -0000 Hi Adrien, > -----Original Message----- > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com] > Sent: Monday, January 30, 2017 9:33 AM > To: De Lara Guarch, Pablo > Cc: Wu, Jingjing; dev@dpdk.org > Subject: Re: [PATCH v2] app/testpmd: fix memory leak >=20 > Hi Pablo, >=20 > On Fri, Jan 27, 2017 at 02:54:58PM +0000, Pablo de Lara wrote: > > Free memory when port flow entry creation fails. > > > > Coverity issue: 139600 > > Fixes: 938a184a1870 ("app/testpmd: implement basic support for flow > API") > > > > Signed-off-by: Pablo de Lara > > --- > > Changes in v2: > > > > - Removed unnecessary conditional > > > > app/test-pmd/config.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > > index 5834498..467932f 100644 > > --- a/app/test-pmd/config.c > > +++ b/app/test-pmd/config.c > > @@ -954,6 +954,7 @@ port_flow_new(const struct rte_flow_attr *attr, > > goto store; > > } > > notsup: > > + free(pf); > > rte_errno =3D err; > > return NULL; > > } > > -- > > 2.7.4 > > >=20 > I think this is a false positive, which is why I did not address it durin= g > the last round of Coverity issues. >=20 > As a two-pass function, errors are checked during the first pass, when pf= is > not allocated yet. During the second pass, intermediate functions are not > supposed to return a different result and "notsup" cannot occur. >=20 > I think assert()/rte_assert() would make more sense and should fool > Coverity > into understanding the expected behavior. >=20 > The commit log should reflect that we are addressing a false positive sin= ce > there is no problem with the code logic (of course unless I missed anythi= ng > obvious). Then, I would just ignore the coverity issue, changing the status to intent= ional. Thanks, Pablo >=20 > Thanks. >=20 > -- > Adrien Mazarguil > 6WIND