Skip to contentSkip to conversation

arch/i386/kernel/cpu/cpufreq/powernow-k8.c: fix a check-after-use

PATCH In review Adrian Bunk 2 participants 2 messages Apr 18, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/i386/kernel/cpu/cpufreq/powernow-k8.c: fix a check-after-use

This patch fixes a check-after-use introduced by commit 4211a30349e8d2b724cfb4ce2584604f5e59c299 and spotted by the Coverity checker.

---

 arch/i386/kernel/cpu/cpufreq/powernow-k8.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/i386/kernel/cpu/cpufreq/powernow-k8.c renamed from arch/i386/kernel/cpu/cpufreq/powernow-k8.c.old +5 -2
@@ -905,14 +905,17 @@ static int powernowk8_target(struct cpuf
 {
 	cpumask_t oldmask = CPU_MASK_ALL;
 	struct powernow_k8_data *data = powernow_data[pol->cpu];
-	u32 checkfid = data->currfid;
-	u32 checkvid = data->currvid;
+	u32 checkfid;
+	u32 checkvid;
 	unsigned int newstate;
 	int ret = -EIO;
 
 	if (!data)
 		return -EINVAL;
 
+	checkfid = data->currfid;
+	checkvid = data->currvid;
+
 	/* only run on specific CPU from here on */
 	oldmask = current->cpus_allowed;
 	set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
#1 lore raw
Quoted 3 lines · Adrian Bunk

This patch fixes a check-after-use introduced by commit 4211a30349e8d2b724cfb4ce2584604f5e59c299 and spotted by the Coverity checker.

Good catch. Should probably go into 2.6.17

-Andi

Quoted 31 lines

---

 arch/i386/kernel/cpu/cpufreq/powernow-k8.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/i386/kernel/cpu/cpufreq/powernow-k8.c renamed from arch/i386/kernel/cpu/cpufreq/powernow-k8.c.old +5 -2
@@ -905,14 +905,17 @@ static int powernowk8_target(struct cpuf
 {
 	cpumask_t oldmask = CPU_MASK_ALL;
 	struct powernow_k8_data *data = powernow_data[pol->cpu];
-	u32 checkfid = data->currfid;
-	u32 checkvid = data->currvid;
+	u32 checkfid;
+	u32 checkvid;
 	unsigned int newstate;
 	int ret = -EIO;
 
 	if (!data)
 		return -EINVAL;
 
+	checkfid = data->currfid;
+	checkvid = data->currvid;
+
 	/* only run on specific CPU from here on */
 	oldmask = current->cpus_allowed;
 	set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));