linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Len Brown <lenb@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tools/power turbostat: fix file descriptor leaks
Date: Mon, 8 Apr 2019 13:04:52 -0400	[thread overview]
Message-ID: <16370c2e-c5f9-a4cf-02fc-6b5b4ab65e1c@redhat.com> (raw)
In-Reply-To: <20190408161240.GA30623@embeddedor>



On 4/8/19 12:12 PM, Gustavo A. R. Silva wrote:
> Fix file descriptor leaks by closing fp before return.
> 
> Addresses-Coverity-ID: 1444591 ("Resource leak")
> Addresses-Coverity-ID: 1444592 ("Resource leak")
> Fixes: 5ea7647b333f ("tools/power turbostat: Warn on bad ACPI LPIT data")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Reviewed-by: Prarit Bhargava <prarit@redhat.com>

P.

> ---
>  tools/power/x86/turbostat/turbostat.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
> index c7727be9719f..78d9acba8e9b 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -2924,6 +2924,7 @@ int snapshot_cpu_lpi_us(void)
>  	if (retval != 1) {
>  		fprintf(stderr, "Disabling Low Power Idle CPU output\n");
>  		BIC_NOT_PRESENT(BIC_CPU_LPI);
> +		fclose(fp);
>  		return -1;
>  	}
>  
> @@ -2950,6 +2951,7 @@ int snapshot_sys_lpi_us(void)
>  	if (retval != 1) {
>  		fprintf(stderr, "Disabling Low Power Idle System output\n");
>  		BIC_NOT_PRESENT(BIC_SYS_LPI);
> +		fclose(fp);
>  		return -1;
>  	}
>  	fclose(fp);
> 

  parent reply	other threads:[~2019-04-08 17:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 16:12 [PATCH] tools/power turbostat: fix file descriptor leaks Gustavo A. R. Silva
2019-04-08 16:12 ` Gustavo A. R. Silva
2019-04-08 17:04 ` Prarit Bhargava [this message]
2019-04-08 17:04   ` Prarit Bhargava
2019-04-22 15:15   ` Gustavo A. R. Silva
2019-04-22 15:15     ` Gustavo A. R. Silva
2019-04-23  8:23     ` Rafael J. Wysocki
2019-04-23  8:23       ` Rafael J. Wysocki
2019-08-26  4:03       ` Gustavo A. R. Silva
2019-08-26  7:55         ` Rafael J. Wysocki
     [not found]           ` <841150bdcbd88a00a30a7ba86272918263959699.camel@gmail.com>
2019-08-26  8:13             ` Rafael J. Wysocki

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=16370c2e-c5f9-a4cf-02fc-6b5b4ab65e1c@redhat.com \
    --to=prarit@redhat.com \
    --cc=gustavo@embeddedor.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.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).