From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, David Hunt <david.hunt@intel.com>
Cc: anatoly.burakov@intel.com, David Marchand <david.marchand@redhat.com>
Subject: [dpdk-dev] [PATCH v2 1/1] power: fix potential null dereferences
Date: Fri, 9 Jul 2021 15:55:59 +0000 [thread overview]
Message-ID: <634db86689fc6a6ff28c5e59aff340d81f711a42.1625846156.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <77dc13d24d7c77526e088756784ce073bc02fe7f.1625842874.git.anatoly.burakov@intel.com>
Currently, the error paths can lead to attempts at dereferencing NULL
pointers. Add the check to avoid attempts at dereferencing NULL
pointers.
Coverity issue: 371895
Coverity issue: 371889
Fixes: 06cffd468fdd ("power: refactor ACPI and intel_pstate support")
Cc: anatoly.burakov@intel.com
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.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
next prev parent reply other threads:[~2021-07-09 15:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-09 15:01 [dpdk-dev] [PATCH v1 " Anatoly Burakov
2021-07-09 15:09 ` David Marchand
2021-07-09 15:19 ` David Hunt
2021-07-09 15:55 ` Anatoly Burakov [this message]
2021-07-20 15:21 ` [dpdk-dev] [PATCH v2 " David Marchand
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=634db86689fc6a6ff28c5e59aff340d81f711a42.1625846156.git.anatoly.burakov@intel.com \
--to=anatoly.burakov@intel.com \
--cc=david.hunt@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.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).