DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 1/1] power: fix potential null dereferences
@ 2021-07-09 15:01 Anatoly Burakov
  2021-07-09 15:09 ` David Marchand
  2021-07-09 15:55 ` [dpdk-dev] [PATCH v2 " Anatoly Burakov
  0 siblings, 2 replies; 5+ messages in thread
From: Anatoly Burakov @ 2021-07-09 15:01 UTC (permalink / raw)
  To: dev, David Hunt; +Cc: anatoly.burakov

Currently, the error paths can lead to attempts at dereferencing NULL
pointers. Add the check to avoid attempts at dereferencing NULL
pointers.

Fixes: 06cffd468fdd ("power: refactor ACPI and intel_pstate support")
Cc: anatoly.burakov@intel.com

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/power/power_pstate_cpufreq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c
index ba28ddcfca..3b607515fd 100644
--- a/lib/power/power_pstate_cpufreq.c
+++ b/lib/power/power_pstate_cpufreq.c
@@ -440,8 +440,10 @@ power_get_available_freqs(struct pstate_power_info *pi)
 			num_freqs, pi->lcore_id);
 
 out:
-	fclose(f_min);
-	fclose(f_max);
+	if (f_min != NULL)
+		fclose(f_min);
+	if (f_max != NULL)
+		fclose(f_max);
 
 	return ret;
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-20 15:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 15:01 [dpdk-dev] [PATCH v1 1/1] power: fix potential null dereferences Anatoly Burakov
2021-07-09 15:09 ` David Marchand
2021-07-09 15:19   ` David Hunt
2021-07-09 15:55 ` [dpdk-dev] [PATCH v2 " Anatoly Burakov
2021-07-20 15:21   ` David Marchand

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