Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Don't run off the beginning of an array fro...



details:   https://anonhg.NetBSD.org/src/rev/112062453348
branches:  trunk
changeset: 770675:112062453348
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Sat Oct 29 09:58:23 2011 +0000

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

diffstat:

 sys/arch/x86/x86/powernow.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r e34fad565a2f -r 112062453348 sys/arch/x86/x86/powernow.c
--- a/sys/arch/x86/x86/powernow.c       Sat Oct 29 09:21:31 2011 +0000
+++ b/sys/arch/x86/x86/powernow.c       Sat Oct 29 09:58:23 2011 +0000
@@ -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 @@
        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",



Home | Main Index | Thread Index | Old Index