From: "Jayachandran C." <jchandra@digeo.com>
To: cpufreq@lists.linux.org.uk
Cc: Andrew Morton <akpm@osdl.org>, davej@codemonkey.org.uk
Subject: [PATCH] cpufreq: Fix issue found by coverity in drivers/cpufreq/cpufreq_stats.c
Date: Thu, 27 Oct 2005 15:37:02 -0700 [thread overview]
Message-ID: <20051027223702.GC20378@random.pao.digeo.com> (raw)
This fixes an issue found in drivers/cpufreq/cpufreq_stats.c by Coverity. Please
review as I'm not sure if -EINVAL is the correct value to return at this point.
Error reported:
CID: 2642
Checker: NULL_RETURNS (help)
File: /export2/p4-coverity/mc2/linux26/drivers/cpufreq/cpufreq_stats.c
Function: cpufreq_stats_create_table
Description: Dereferencing NULL value "data"
Patch description:
The return of cpufreq_cpu_get can be NULL, check return code and return
-EINVAL if it is NULL.
Signed-off-by: Jayachandran C. <c.jayachandran at gmail.com>
---
cpufreq_stats.c | 6 ++++++
1 files changed, 6 insertions(+)
--- linux-2.6.14-rc4-git2.clean/drivers/cpufreq/cpufreq_stats.c 2005-08-28 16:41:01.000000000 -0700
+++ linux-2.6.14-rc4-git2/drivers/cpufreq/cpufreq_stats.c 2005-10-25 18:47:06.639018548 -0700
@@ -197,6 +197,11 @@
memset(stat, 0, sizeof (struct cpufreq_stats));
data = cpufreq_cpu_get(cpu);
+ if (data == NULL) {
+ ret = -EINVAL;
+ goto error_get_fail;
+ }
+
if ((ret = sysfs_create_group(&data->kobj, &stats_attr_group)))
goto error_out;
@@ -244,6 +249,7 @@
return 0;
error_out:
cpufreq_cpu_put(data);
+error_get_fail:
kfree(stat);
cpufreq_stats_table[cpu] = NULL;
return ret;
next reply other threads:[~2005-10-27 22:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-27 22:37 Jayachandran C. [this message]
2005-10-27 23:04 ` [PATCH] cpufreq: Fix issue found by coverity in drivers/cpufreq/cpufreq_stats.c Dave Jones
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=20051027223702.GC20378@random.pao.digeo.com \
--to=jchandra@digeo.com \
--cc=akpm@osdl.org \
--cc=cpufreq@lists.linux.org.uk \
--cc=davej@codemonkey.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.