RE: [PATCH] acpi-cpufreq: Read buffer overflow?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>If `data->acpi_data.state_count' is 0, we read from data-
>>acpi_data.states[-1].
>
>Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
>---
>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
--
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Sparc Linux]     [DCCP]     [Linux ARM]     [Yosemite News]     [Linux SCSI]     [Linux x86_64]     [Linux for Ham Radio]

  Powered by Linux