]> err.no Git - linux-2.6/commitdiff
[CPUFREQ] x86_64: Proper null pointer check in powernow_k8_get
authorjacob.shin@amd.com <jacob.shin@amd.com>
Fri, 7 Apr 2006 17:49:51 +0000 (19:49 +0200)
committerDave Jones <davej@redhat.com>
Mon, 10 Apr 2006 23:14:33 +0000 (18:14 -0500)
This prevents crashes on dual core system when enough ticks are lost.

Replaces earlier patch by me.

(Duplicate null data check in powernowk8_get() removed -- davej)

 arch/i386/kernel/cpu/cpufreq/powernow-k8.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Dave Jones <davej@redhat.com>
arch/i386/kernel/cpu/cpufreq/powernow-k8.c

index 6ba497c47df63409cdf8c8b622a60c96be27c810..30bb6fd5b2b268762faea09b5b9969e0fda47c44 100644 (file)
@@ -46,7 +46,7 @@
 
 #define PFX "powernow-k8: "
 #define BFX PFX "BIOS error: "
-#define VERSION "version 1.60.1"
+#define VERSION "version 1.60.2"
 #include "powernow-k8.h"
 
 /* serialize freq changes  */
@@ -910,6 +910,9 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
        unsigned int newstate;
        int ret = -EIO;
 
+       if (!data)
+               return -EINVAL;
+
        /* only run on specific CPU from here on */
        oldmask = current->cpus_allowed;
        set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
@@ -969,6 +972,9 @@ static int powernowk8_verify(struct cpufreq_policy *pol)
 {
        struct powernow_k8_data *data = powernow_data[pol->cpu];
 
+       if (!data)
+               return -EINVAL;
+
        return cpufreq_frequency_table_verify(pol, data->powernow_table);
 }