summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-08-11 18:44:06 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-08-11 18:44:06 +0000
commit6a877e9870ae505ac58c542fbf8e5ef5bb58b8ef (patch)
tree7a135b492d4d9e4502856a6fa757a3d8df4852cd /sys
parenta6235ea9f44b36a886c9594593dd80fc9d47fa90 (diff)
The PowerMac9,1 has 4 sensors on its smu(4), so increase the maximum number.
Also add a check for the maximum number of sensors like we already have for the number of fans such that we avoid mysterious hangs on machines with more than 4 sensors.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/dev/smu.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/arch/macppc/dev/smu.c b/sys/arch/macppc/dev/smu.c
index bbc900cf49e..51beb3a692e 100644
--- a/sys/arch/macppc/dev/smu.c
+++ b/sys/arch/macppc/dev/smu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smu.c,v 1.19 2007/05/20 23:38:52 thib Exp $ */
+/* $OpenBSD: smu.c,v 1.20 2009/08/11 18:44:05 kettenis Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -46,7 +46,7 @@ struct smu_fan {
struct ksensor sensor;
};
-#define SMU_MAXSENSORS 3
+#define SMU_MAXSENSORS 4
struct smu_sensor {
u_int8_t reg;
@@ -314,6 +314,11 @@ smu_attach(struct device *parent, struct device *self, void *aux)
OF_getprop(node, "device_type", type, sizeof type) <= 0)
continue;
+ if (sc->sc_num_sensors >= SMU_MAXSENSORS) {
+ printf(": too many sensors\n");
+ return;
+ }
+
sensor = &sc->sc_sensors[sc->sc_num_sensors++];
sensor->sensor.flags = SENSOR_FINVALID;
sensor->reg = val;