kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] intel_idle: Fix uninitialized variable bug
@ 2020-06-24 13:19 Dan Carpenter
  2020-06-24 13:41 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2020-06-24 13:19 UTC (permalink / raw)
  To: Jacob Pan, Rafael J. Wysocki
  Cc: Len Brown, linux-pm, linux-kernel, kernel-janitors, Kees Cook

The "tick" variable isn't initialized if "lapic_timer_always_reliable"
is true.

Fixes: 40ab82e08d78 ("intel_idle: Simplify LAPIC timer reliability checks")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/idle/intel_idle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index aae53e650638..6c9152f303a6 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -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();
 
 	/*
-- 
2.27.0

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

* Re: [PATCH] intel_idle: Fix uninitialized variable bug
  2020-06-24 13:19 [PATCH] intel_idle: Fix uninitialized variable bug Dan Carpenter
@ 2020-06-24 13:41 ` Rafael J. Wysocki
  2020-06-25  9:04   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2020-06-24 13:41 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jacob Pan, Rafael J. Wysocki, Len Brown, Linux PM,
	Linux Kernel Mailing List, kernel-janitors, Kees Cook

On Wed, Jun 24, 2020 at 3:19 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> 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.

> Fixes: 40ab82e08d78 ("intel_idle: Simplify LAPIC timer reliability checks")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/idle/intel_idle.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
> index aae53e650638..6c9152f303a6 100644
> --- a/drivers/idle/intel_idle.c
> +++ b/drivers/idle/intel_idle.c
> @@ -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();
>
>         /*
> --

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

* Re: [PATCH] intel_idle: Fix uninitialized variable bug
  2020-06-24 13:41 ` Rafael J. Wysocki
@ 2020-06-25  9:04   ` Dan Carpenter
  2020-06-25 10:37     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2020-06-25  9:04 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Jacob Pan, Rafael J. Wysocki, Len Brown, Linux PM,
	Linux Kernel Mailing List, kernel-janitors, Kees Cook

On Wed, Jun 24, 2020 at 03:41:05PM +0200, Rafael J. Wysocki wrote:
> On Wed, Jun 24, 2020 at 3:19 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > 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.

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

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

* Re: [PATCH] intel_idle: Fix uninitialized variable bug
  2020-06-25  9:04   ` Dan Carpenter
@ 2020-06-25 10:37     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2020-06-25 10:37 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Rafael J. Wysocki, Jacob Pan, Rafael J. Wysocki, Len Brown,
	Linux PM, Linux Kernel Mailing List, kernel-janitors, Kees Cook

On Thu, Jun 25, 2020 at 11:05 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Wed, Jun 24, 2020 at 03:41:05PM +0200, Rafael J. Wysocki wrote:
> > On Wed, Jun 24, 2020 at 3:19 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > >
> > > 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.
>
> Can the lapic_timer_always_reliable variable just be removed entirely
> and replaced with an static_cpu_has(X86_FEATURE_ARAT) check?

Yes, it can.

See https://patchwork.kernel.org/patch/11623309/

Thanks!

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

end of thread, other threads:[~2020-06-25 10:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 13:19 [PATCH] intel_idle: Fix uninitialized variable bug Dan Carpenter
2020-06-24 13:41 ` Rafael J. Wysocki
2020-06-25  9:04   ` Dan Carpenter
2020-06-25 10:37     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).