power: fix resource leak by open file pointers

Message ID 20221012082928.2171562-1-tadhg.kearney@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series power: fix resource leak by open file pointers |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Tadhg Kearney Oct. 12, 2022, 8:29 a.m. UTC
  Close file pointers to Intel uncore sysfiles.

Coverity issue: 381400 381397
Fixes: 60b8a661a957 ("power: add Intel uncore frequency control")
CC: david.hunt@intel.com

Signed-off-by: Tadhg Kearney <tadhg.kearney@intel.com>
---
 lib/power/rte_power_intel_uncore.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Pattan, Reshma Oct. 17, 2022, 8:37 a.m. UTC | #1
> -----Original Message-----
> From: Kearney, Tadhg <tadhg.kearney@intel.com>
> Sent: Wednesday, October 12, 2022 9:29 AM
> To: dev@dpdk.org
> Cc: Hunt, David <david.hunt@intel.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>; Kearney, Tadhg <tadhg.kearney@intel.com>
> Subject: [PATCH] power: fix resource leak by open file pointers
> 
> Close file pointers to Intel uncore sysfiles.
> 
> Coverity issue: 381400 381397
> Fixes: 60b8a661a957 ("power: add Intel uncore frequency control")
> CC: david.hunt@intel.com
> 
> Signed-off-by: Tadhg Kearney <tadhg.kearney@intel.com>
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
  
Thomas Monjalon Oct. 26, 2022, 9:30 p.m. UTC | #2
> > Close file pointers to Intel uncore sysfiles.
> > 
> > Coverity issue: 381400 381397
> > Fixes: 60b8a661a957 ("power: add Intel uncore frequency control")
> > CC: david.hunt@intel.com
> > 
> > Signed-off-by: Tadhg Kearney <tadhg.kearney@intel.com>
> Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
> Acked-by: Reshma Pattan <reshma.pattan@intel.com>

Applied, thanks.
  

Patch

diff --git a/lib/power/rte_power_intel_uncore.c b/lib/power/rte_power_intel_uncore.c
index 3afe8feffa..f86e1c8b7a 100644
--- a/lib/power/rte_power_intel_uncore.c
+++ b/lib/power/rte_power_intel_uncore.c
@@ -192,6 +192,11 @@  power_init_for_setting_uncore_freq(struct uncore_power_info *ui)
 	ui->init_max_freq = base_max_freq;
 	ui->init_min_freq = base_min_freq;
 
+	fclose(f_base_min);
+	fclose(f_base_max);
+	fclose(f_max);
+	fclose(f_min);
+
 	return 0;
 
 err: