Module Name:    src
Committed By:   jruoho
Date:           Wed Mar  2 06:23:17 UTC 2011

Modified Files:
        src/sys/arch/x86/acpi: acpi_cpu_md.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x86/acpi/acpi_cpu_md.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/acpi/acpi_cpu_md.c
diff -u src/sys/arch/x86/acpi/acpi_cpu_md.c:1.51 src/sys/arch/x86/acpi/acpi_cpu_md.c:1.52
--- src/sys/arch/x86/acpi/acpi_cpu_md.c:1.51	Wed Mar  2 06:17:09 2011
+++ src/sys/arch/x86/acpi/acpi_cpu_md.c	Wed Mar  2 06:23:17 2011
@@ -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 <jruoho...@iki.fi>
@@ -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];
 

Reply via email to