From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 7A3122C17 for ; Fri, 3 May 2019 11:26:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2019 02:26:23 -0700 X-ExtLoop1: 1 Received: from dhunt5-mobl2.ger.corp.intel.com (HELO [10.237.221.92]) ([10.237.221.92]) by orsmga002.jf.intel.com with ESMTP; 03 May 2019 02:26:22 -0700 To: Liang Ma , dev@dpdk.org Cc: anatoly.burakov@intel.com References: <1554736884-12195-1-git-send-email-liang.j.ma@intel.com> <1554740356-13914-1-git-send-email-liang.j.ma@intel.com> From: "Hunt, David" Message-ID: <7e2a06bb-03eb-e622-d5cc-4a844c80c178@intel.com> Date: Fri, 3 May 2019 10:26:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1554740356-13914-1-git-send-email-liang.j.ma@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v2] power: fix coverity issue 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: Fri, 03 May 2019 09:26:25 -0000 On 8/4/2019 5:19 PM, Liang Ma wrote: > Fix the resource leaking issue > > Coverity issue: 337668 > > Fixes: b60fd5f8b1ce8f0a2c ("power: add bit for high frequency cores") > > Signed-off-by: Liang Ma > --- > lib/librte_power/power_pstate_cpufreq.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c > index 336c13869..07ca5c1dd 100644 > --- a/lib/librte_power/power_pstate_cpufreq.c > +++ b/lib/librte_power/power_pstate_cpufreq.c > @@ -158,6 +158,7 @@ power_init_for_setting_freq(struct pstate_power_info *pi) > char *s_base; > uint32_t base_ratio = 0; > uint64_t max_non_turbo = 0; > + int ret_val = 0; > > snprintf(fullpath_min, sizeof(fullpath_min), POWER_SYSFILE_MIN_FREQ, > pi->lcore_id); > @@ -199,8 +200,10 @@ power_init_for_setting_freq(struct pstate_power_info *pi) > > /* Add MSR read to detect turbo status */ > > - if (power_rdmsr(PLATFORM_INFO, &max_non_turbo, pi->lcore_id) < 0) > - return -1; > + if (power_rdmsr(PLATFORM_INFO, &max_non_turbo, pi->lcore_id) < 0) { > + ret_val = -1; > + goto out; > + } > > max_non_turbo = (max_non_turbo&NON_TURBO_MASK)>>NON_TURBO_OFFSET; > > @@ -219,7 +222,9 @@ power_init_for_setting_freq(struct pstate_power_info *pi) > pi->core_base_freq = base_ratio * BUS_FREQ; > > out: > - return 0; > + if (f_base != NULL) > + fclose(f_base); > + return ret_val; > } > > static int Confirmed that this issue is resolved by testing on our internel Coverity server here, version 8.7.1 Tested-by: David Hunt From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 190FEA0AC5 for ; Fri, 3 May 2019 11:26:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EE6172C4F; Fri, 3 May 2019 11:26:25 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 7A3122C17 for ; Fri, 3 May 2019 11:26:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2019 02:26:23 -0700 X-ExtLoop1: 1 Received: from dhunt5-mobl2.ger.corp.intel.com (HELO [10.237.221.92]) ([10.237.221.92]) by orsmga002.jf.intel.com with ESMTP; 03 May 2019 02:26:22 -0700 To: Liang Ma , dev@dpdk.org Cc: anatoly.burakov@intel.com References: <1554736884-12195-1-git-send-email-liang.j.ma@intel.com> <1554740356-13914-1-git-send-email-liang.j.ma@intel.com> From: "Hunt, David" Message-ID: <7e2a06bb-03eb-e622-d5cc-4a844c80c178@intel.com> Date: Fri, 3 May 2019 10:26:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <1554740356-13914-1-git-send-email-liang.j.ma@intel.com> Content-Type: text/plain; charset="UTF-8"; format="flowed" Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH v2] power: fix coverity issue 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190503092621.CDpJXgm3aGA3JLbP5d2wE-NIjZd_zZr1I3mkKjjnYi0@z> On 8/4/2019 5:19 PM, Liang Ma wrote: > Fix the resource leaking issue > > Coverity issue: 337668 > > Fixes: b60fd5f8b1ce8f0a2c ("power: add bit for high frequency cores") > > Signed-off-by: Liang Ma > --- > lib/librte_power/power_pstate_cpufreq.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c > index 336c13869..07ca5c1dd 100644 > --- a/lib/librte_power/power_pstate_cpufreq.c > +++ b/lib/librte_power/power_pstate_cpufreq.c > @@ -158,6 +158,7 @@ power_init_for_setting_freq(struct pstate_power_info *pi) > char *s_base; > uint32_t base_ratio = 0; > uint64_t max_non_turbo = 0; > + int ret_val = 0; > > snprintf(fullpath_min, sizeof(fullpath_min), POWER_SYSFILE_MIN_FREQ, > pi->lcore_id); > @@ -199,8 +200,10 @@ power_init_for_setting_freq(struct pstate_power_info *pi) > > /* Add MSR read to detect turbo status */ > > - if (power_rdmsr(PLATFORM_INFO, &max_non_turbo, pi->lcore_id) < 0) > - return -1; > + if (power_rdmsr(PLATFORM_INFO, &max_non_turbo, pi->lcore_id) < 0) { > + ret_val = -1; > + goto out; > + } > > max_non_turbo = (max_non_turbo&NON_TURBO_MASK)>>NON_TURBO_OFFSET; > > @@ -219,7 +222,9 @@ power_init_for_setting_freq(struct pstate_power_info *pi) > pi->core_base_freq = base_ratio * BUS_FREQ; > > out: > - return 0; > + if (f_base != NULL) > + fclose(f_base); > + return ret_val; > } > > static int Confirmed that this issue is resolved by testing on our internel Coverity server here, version 8.7.1 Tested-by: David Hunt