DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Hunt, David" <david.hunt@intel.com>
To: Liang Ma <liang.j.ma@intel.com>, dev@dpdk.org
Cc: anatoly.burakov@intel.com
Subject: Re: [dpdk-dev] [PATCH v2] power: fix coverity issue
Date: Fri, 3 May 2019 10:26:21 +0100	[thread overview]
Message-ID: <7e2a06bb-03eb-e622-d5cc-4a844c80c178@intel.com> (raw)
Message-ID: <20190503092621.CDpJXgm3aGA3JLbP5d2wE-NIjZd_zZr1I3mkKjjnYi0@z> (raw)
In-Reply-To: <1554740356-13914-1-git-send-email-liang.j.ma@intel.com>


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 <liang.j.ma@intel.com>
> ---
>   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 <david.hunt@intel.com>




  parent reply	other threads:[~2019-05-03  9:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 15:21 [dpdk-dev] [PATCH] " Liang Ma
2019-04-08 15:21 ` Liang Ma
2019-04-08 15:32 ` Hunt, David
2019-04-08 15:32   ` Hunt, David
2019-04-08 16:19 ` [dpdk-dev] [PATCH v2] " Liang Ma
2019-04-08 16:19   ` Liang Ma
2019-05-03  9:26   ` Hunt, David [this message]
2019-05-03  9:26     ` Hunt, David
2019-05-09 18:46     ` Thomas Monjalon
2019-05-09 18:46       ` Thomas Monjalon

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=7e2a06bb-03eb-e622-d5cc-4a844c80c178@intel.com \
    --to=david.hunt@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=liang.j.ma@intel.com \
    /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).