All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi-cpufreq: Read buffer overflow?
@ 2009-08-07 20:12 Roel Kluin
  2009-08-07 20:41 ` Yu, Fenghua
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-08-07 20:12 UTC (permalink / raw)
  To: linux-ia64

If `data->acpi_data.state_count' is 0, we read from data->acpi_data.states[-1].

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Unsure whether this can happen.

diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
index 7b43545..7cdd1f6 100644
--- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
+++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
@@ -95,7 +95,7 @@ extract_clock (
 		if (value = data->acpi_data.states[i].status)
 			return data->acpi_data.states[i].core_frequency;
 	}
-	return data->acpi_data.states[i-1].core_frequency;
+	return i ? data->acpi_data.states[i-1].core_frequency : 0;
 }
 
 

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

* RE: [PATCH] acpi-cpufreq: Read buffer overflow?
  2009-08-07 20:12 [PATCH] acpi-cpufreq: Read buffer overflow? Roel Kluin
@ 2009-08-07 20:41 ` Yu, Fenghua
  0 siblings, 0 replies; 2+ messages in thread
From: Yu, Fenghua @ 2009-08-07 20:41 UTC (permalink / raw)
  To: linux-ia64

>If `data->acpi_data.state_count' is 0, we read from data-
>>acpi_data.states[-1].
>
>Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>---
>Unsure whether this can happen.
>
>diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
>b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
>index 7b43545..7cdd1f6 100644
>--- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
>+++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
>@@ -95,7 +95,7 @@ extract_clock (
> 		if (value = data->acpi_data.states[i].status)
> 			return data->acpi_data.states[i].core_frequency;
> 	}
>-	return data->acpi_data.states[i-1].core_frequency;
>+	return i ? data->acpi_data.states[i-1].core_frequency : 0;
> }
>
>
If state_count<=1, cpufreq driver initialization acpi_cpufreq_cpu_init will fail since there is no P-states to switch to. Other cpufreq functions won't be called if initialization fails. So it's unnecessary to do sanity check for state_count in here again or in other related functions.

Thanks.

-Fenghua

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

end of thread, other threads:[~2009-08-07 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-07 20:12 [PATCH] acpi-cpufreq: Read buffer overflow? Roel Kluin
2009-08-07 20:41 ` Yu, Fenghua

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.