Module Name:    src
Committed By:   jnemeth
Date:           Sat Oct 29 09:58:24 UTC 2011

Modified Files:
        src/sys/arch/x86/x86: powernow.c

Log Message:
Don't run off the beginning of an array from Maurizio Lombardi.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/powernow.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/x86/powernow.c
diff -u src/sys/arch/x86/x86/powernow.c:1.3 src/sys/arch/x86/x86/powernow.c:1.4
--- src/sys/arch/x86/x86/powernow.c:1.3	Fri Mar  4 04:53:28 2011
+++ src/sys/arch/x86/x86/powernow.c	Sat Oct 29 09:58:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: powernow.c,v 1.3 2011/03/04 04:53:28 jruoho Exp $ */
+/*	$NetBSD: powernow.c,v 1.4 2011/10/29 09:58:23 jnemeth Exp $ */
 /*	$OpenBSD: powernow-k8.c,v 1.8 2006/06/16 05:58:50 gwk Exp $ */
 
 /*-
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: powernow.c,v 1.3 2011/03/04 04:53:28 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: powernow.c,v 1.4 2011/10/29 09:58:23 jnemeth Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -418,8 +418,8 @@ powernow_k7_init(device_t self)
 	for (i = 0; i < sc->sc_state->n_states; i++) {
 
 		/* Skip duplicated matches. */
-		if (sc->sc_state->state_table[i].freq ==
-		    sc->sc_state->state_table[i - 1].freq)
+		if (i > 0 && (sc->sc_state->state_table[i].freq ==
+		    sc->sc_state->state_table[i - 1].freq))
 			continue;
 
 		DPRINTF(("%s: cstate->state_table.freq=%d\n",

Reply via email to