intel_idle: Fix uninitialized variable bug
Subsystems (2)
PATCH 1/1 intel_idle: Fix uninitialized variable bug
The "tick" variable isn't initialized if "lapic_timer_always_reliable" is true.
--- drivers/idle/intel_idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/idle/intel_idle.c +1 -1
@@ -132,7 +132,7 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,struct cpuidle_state *state = &drv->states[index];unsigned long eax =flg2MWAIT (state->flags);unsigned long ecx =1 ;/* break on interrupt flag */ -bool tick; +bool tick = false;int cpu =smp_processor_id ();/*
Signature · 1 line
2.27.0
Rafael J. Wysocki
maintainerQuoted 3 lines · Dan Carpenter
The "tick" variable isn't initialized if "
lapic_timer_always_reliable" is true.
If lapic_timer_always_reliable is true, then static_cpu_has(X86_FEATURE_ARAT) must also be true AFAICS.
So the lapic_timer_always_reliable check in there looks redundant.
Quoted 20 lines
Fixes 40ab82e08d78 ("intel_idle: Simplify LAPIC timer reliability checks")Signed-off-by Dan Carpenter <[email protected]>--- drivers/idle/intel_idle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/idle/intel_idle.c +1
-2@@ -132,7 +132,7 @@ static __cpuidle int intel_idle(struct cpuidle_device *dev,struct cpuidle_state *state = &drv->states[index];unsigned long eax =flg2MWAIT (state->flags);unsigned long ecx =1 ;/* break on interrupt flag */ -bool tick; +bool tick = false;int cpu =smp_processor_id ();/* --
Quoted 9 lines · Rafael J. Wysocki
Quoted 3 lines · Dan Carpenter
The "tick" variable isn't initialized if "
lapic_timer_always_reliable" is true.If
lapic_timer_always_reliableis true, thenstatic_cpu_has(X86_FEATURE_ARAT)must also be true AFAICS.So the
lapic_timer_always_reliablecheck in there looks redundant.
Can the lapic_timer_always_reliable variable just be removed entirely and replaced with an static_cpu_has(X86_FEATURE_ARAT) check?
regards,
dan carpenter
Rafael J. Wysocki
maintainerQuoted 7 lines · Dan Carpenter
Quoted 5 lines · Rafael J. Wysocki
Quoted 3 lines · Dan Carpenter
The "tick" variable isn't initialized if "
lapic_timer_always_reliable" is true.
Quoted 7 lines
Quoted 4 lines
If
lapic_timer_always_reliableis true, thenstatic_cpu_has(X86_FEATURE_ARAT)must also be true AFAICS.So the
lapic_timer_always_reliablecheck in there looks redundant.Can the
lapic_timer_always_reliablevariable just be removed entirely and replaced with anstatic_cpu_has(X86_FEATURE_ARAT)check?
Yes, it can.
See https://patchwork.kernel.org/patch/11623309/
Thanks!