aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2005-10-27 19:02:06 -0400
committerDave Jones <davej@redhat.com>2005-10-27 19:02:06 -0400
commitbc7b26fd7ca5e0c6e769d3886c022f0a98fd88ec (patch)
tree19f23041be60367024f292780ba3e79ff3259fc8 /drivers
parente98df50c5200ae3c748d69002a8827afc9d2eae2 (diff)
[CPUFREQ] Check return value of cpufreq_cpu_get in cpufreq_stats
This fixes an issue found in drivers/cpufreq/cpufreq_stats.c by Coverity. 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> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpufreq/cpufreq_stats.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index ff16a87125d9..19b4c3e7c390 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -196,6 +196,11 @@ cpufreq_stats_create_table (struct cpufreq_policy *policy,
196 return -ENOMEM; 196 return -ENOMEM;
197 197
198 data = cpufreq_cpu_get(cpu); 198 data = cpufreq_cpu_get(cpu);
199 if (data == NULL) {
200 ret = -EINVAL;
201 goto error_get_fail;
202 }
203
199 if ((ret = sysfs_create_group(&data->kobj, &stats_attr_group))) 204 if ((ret = sysfs_create_group(&data->kobj, &stats_attr_group)))
200 goto error_out; 205 goto error_out;
201 206