All of lore.kernel.org
 help / color / mirror / Atom feed
* Uninitialized use of cmd.val in arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c:423
@ 2007-01-02 15:49 Guillaume Chazarain
  2007-01-02 17:57 ` Uninitialized use of cmd.val inarch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c:423 Pallipadi, Venkatesh
  0 siblings, 1 reply; 3+ messages in thread
From: Guillaume Chazarain @ 2007-01-02 15:49 UTC (permalink / raw)
  To: cpufreq

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

Hi,

In arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c:acpi_cpufreq_target()
cmd.val = (cmd.val & ~INTEL_MSR_RANGE) | msr;

cmd.val seems to be used uninitialized. So, one of the attached patch
should be needed. Both patches, and no patch at all, work for me though.

This is linux-2.6.20-rc3 and the code is really executed (I traced it) with
my Pentium M.

Thanks.

-- 
Guillaume


[-- Attachment #2: acpi-cpufreq-uninitialized-cmd_val1 --]
[-- Type: text/plain, Size: 871 bytes --]

diff -r 90710ed1291f arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	Mon Jan 01 01:00:04 2007 +0000
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	Tue Jan 02 16:26:29 2007 +0100
@@ -372,7 +372,6 @@ static int acpi_cpufreq_target(struct cp
 	struct cpufreq_freqs freqs;
 	cpumask_t online_policy_cpus;
 	struct drv_cmd cmd;
-	unsigned int msr;
 	unsigned int next_state = 0;
 	unsigned int next_perf_state = 0;
 	unsigned int i;
@@ -417,10 +416,9 @@ static int acpi_cpufreq_target(struct cp
 	case SYSTEM_INTEL_MSR_CAPABLE:
 		cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
 		cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
-		msr =
+		cmd.val =
 		    (u32) perf->states[next_perf_state].
 		    control & INTEL_MSR_RANGE;
-		cmd.val = (cmd.val & ~INTEL_MSR_RANGE) | msr;
 		break;
 	case SYSTEM_IO_CAPABLE:
 		cmd.type = SYSTEM_IO_CAPABLE;

[-- Attachment #3: acpi-cpufreq-uninitialized-cmd_val2 --]
[-- Type: text/plain, Size: 506 bytes --]

diff -r 90710ed1291f arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	Mon Jan 01 01:00:04 2007 +0000
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	Tue Jan 02 16:27:47 2007 +0100
@@ -420,6 +420,7 @@ static int acpi_cpufreq_target(struct cp
 		msr =
 		    (u32) perf->states[next_perf_state].
 		    control & INTEL_MSR_RANGE;
+		cmd.val = get_cur_val(online_policy_cpus);
 		cmd.val = (cmd.val & ~INTEL_MSR_RANGE) | msr;
 		break;
 	case SYSTEM_IO_CAPABLE:

[-- Attachment #4: Type: text/plain, Size: 147 bytes --]

_______________________________________________
Cpufreq mailing list
Cpufreq@lists.linux.org.uk
http://lists.linux.org.uk/mailman/listinfo/cpufreq

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-02 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-02 15:49 Uninitialized use of cmd.val in arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c:423 Guillaume Chazarain
2007-01-02 17:57 ` Uninitialized use of cmd.val inarch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c:423 Pallipadi, Venkatesh
2007-01-02 18:58   ` [PATCH] Uninitialized use of cmd.val in arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c:acpi_cpufreq_target() Guillaume Chazarain

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.