Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/acpi Adjust the detection of Turbo Boost to pre...



details:   https://anonhg.NetBSD.org/src/rev/07cd84bbbd77
branches:  trunk
changeset: 762827:07cd84bbbd77
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Wed Mar 02 06:23:17 2011 +0000

description:
Adjust the detection of Turbo Boost to prevent a theoretical array OOB access.

diffstat:

 sys/arch/x86/acpi/acpi_cpu_md.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 27c6a79e0ba6 -r 07cd84bbbd77 sys/arch/x86/acpi/acpi_cpu_md.c
--- a/sys/arch/x86/acpi/acpi_cpu_md.c   Wed Mar 02 06:17:08 2011 +0000
+++ b/sys/arch/x86/acpi/acpi_cpu_md.c   Wed Mar 02 06:23:17 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.51 2011/03/02 06:17:09 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.52 2011/03/02 06:23:17 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.51 2011/03/02 06:17:09 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.52 2011/03/02 06:23:17 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -541,7 +541,8 @@
                 *      in Intel Core(tm) Microarchitectures (Nehalem)
                 *      Based Processors. White Paper, November 2008.
                 */
-               if ((sc->sc_flags & ACPICPU_FLAG_P_TURBO) != 0) {
+               if (sc->sc_pstate_count > 2 &&
+                  (sc->sc_flags & ACPICPU_FLAG_P_TURBO) != 0) {
 
                        ps = &sc->sc_pstate[0];
 



Home | Main Index | Thread Index | Old Index