2019-04-08 16:37:41

by Gustavo A. R. Silva

[permalink] [raw]
Subject: [PATCH] tools/power turbostat: fix file descriptor leaks

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 <[email protected]>
---
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);
--
2.21.0


2019-04-08 17:07:23

by Prarit Bhargava

[permalink] [raw]
Subject: Re: [PATCH] tools/power turbostat: fix file descriptor leaks



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 <[email protected]>

Reviewed-by: Prarit Bhargava <[email protected]>

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);
>

2019-04-22 16:20:36

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH] tools/power turbostat: fix file descriptor leaks

Hi all,

Friendly ping:

Who can take this?

Thanks
--
Gustavo

On 4/8/19 12:04 PM, Prarit Bhargava wrote:
>
>
> 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 <[email protected]>
>
> Reviewed-by: Prarit Bhargava <[email protected]>
>
> 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);
>>

2019-04-23 08:26:07

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] tools/power turbostat: fix file descriptor leaks

On Mon, Apr 22, 2019 at 5:55 PM Gustavo A. R. Silva
<[email protected]> wrote:
>
> Hi all,
>
> Friendly ping:
>
> Who can take this?

I've been waiting for Len to comment on this, let me talk to him offlist.

Thanks!

2019-08-26 04:56:13

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH] tools/power turbostat: fix file descriptor leaks

Hi Rafael,

On 4/23/19 3:23 AM, Rafael J. Wysocki wrote:
> On Mon, Apr 22, 2019 at 5:55 PM Gustavo A. R. Silva
> <[email protected]> wrote:
>>
>> Hi all,
>>
>> Friendly ping:
>>
>> Who can take this?
>
> I've been waiting for Len to comment on this, let me talk to him offlist.
>

I just noticed this hasn't been applied.

I wonder if you plan to apply it.

Thanks
--
Gustavo

2019-08-26 07:57:07

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] tools/power turbostat: fix file descriptor leaks

On Mon, Aug 26, 2019 at 6:25 AM Gustavo A. R. Silva
<[email protected]> wrote:
>
> Hi Rafael,
>
> On 4/23/19 3:23 AM, Rafael J. Wysocki wrote:
> > On Mon, Apr 22, 2019 at 5:55 PM Gustavo A. R. Silva
> > <[email protected]> wrote:
> >>
> >> Hi all,
> >>
> >> Friendly ping:
> >>
> >> Who can take this?
> >
> > I've been waiting for Len to comment on this, let me talk to him offlist.
> >
>
> I just noticed this hasn't been applied.
>
> I wonder if you plan to apply it.

Technically, Len Brown is the turbostat maintainer and I have been
waiting for him to review the patch at least. Let me talk to Len.

Thanks!

2019-08-26 10:00:05

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH] tools/power turbostat: fix file descriptor leaks

On Mon, Aug 26, 2019 at 10:02 AM Artem Bityutskiy <[email protected]> wrote:
>
> On Mon, 2019-08-26 at 09:55 +0200, Rafael J. Wysocki wrote:
>
> Technically, Len Brown is the turbostat maintainer and I have been
>
> waiting for him to review the patch at least. Let me talk to Len.
>
>
>
> Hi Rafael,
>
>
> I also sent a couple of turbostat patches waiting for being acted upon, may be you could include them to the conversation too?

Yes, I will, thanks!