summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-11-12 01:40:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-11-12 01:40:37 +0000
commite0e1079d841a081ed1f32126a366c9122ca6922e (patch)
tree9bfa6d63aaa455ea02b85ffa1289d5b385b431af /sys/arch
parenta23f6be9ed28eafcfea2c2bd8a4664abea537c24 (diff)
if the table got messed up, early loop termination is not gauranteed, and
subsequent code will be out of bounds; unlikely situation. found by parfait ok weingart
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/i386/p4tcc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/arch/i386/i386/p4tcc.c b/sys/arch/i386/i386/p4tcc.c
index 5265d740c98..6c391326ad8 100644
--- a/sys/arch/i386/i386/p4tcc.c
+++ b/sys/arch/i386/i386/p4tcc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: p4tcc.c,v 1.14 2007/08/03 20:36:02 deraadt Exp $ */
+>/* $OpenBSD: p4tcc.c,v 1.15 2009/11/12 01:40:36 deraadt Exp $ */
/*
* Copyright (c) 2003 Ted Unangst
* All rights reserved.
@@ -117,6 +117,8 @@ p4tcc_setperf(int level)
if (level >= tcc[i].level)
break;
}
+ if (i == TCC_LEVELS)
+ i = TCC_LEVELS - 1;
msreg = rdmsr(MSR_THERM_CONTROL);
msreg &= ~0x1e; /* bit 0 reserved */