summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2011-07-21 01:03:30 +0000
committersthen <sthen@openbsd.org>2011-07-21 01:03:30 +0000
commit2ee9b4b124b3534943f13102dc53f5502b86ebd2 (patch)
treec0d6360c7caf689cd9e3c6553090dd9ec6daf441
parent- Make constants const. (diff)
downloadwireguard-openbsd-2ee9b4b124b3534943f13102dc53f5502b86ebd2.tar.xz
wireguard-openbsd-2ee9b4b124b3534943f13102dc53f5502b86ebd2.zip
Index the sensor array starting from 0 not sc_vd_id_low. On my R310 this
is 1 so there, this avoids writing past the end of malloc'd space during init. Also means the correct sensor address is registered so sysctl hw.sensors works. Was: hw.sensors.mpii0.drive0=unknown (sd0), UNKNOWN Now: hw.sensors.mpii0.drive0=online (sd0), OK ok dlg@
-rw-r--r--sys/dev/pci/mpii.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c
index ae37b530749..87b9835b288 100644
--- a/sys/dev/pci/mpii.c
+++ b/sys/dev/pci/mpii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpii.c,v 1.46 2011/07/20 19:00:35 sthen Exp $ */
+/* $OpenBSD: mpii.c,v 1.47 2011/07/21 01:03:30 sthen Exp $ */
/*
* Copyright (c) 2010 Mike Belopuhov <mkb@crypt.org.ru>
* Copyright (c) 2009 James Giannoules
@@ -5293,9 +5293,8 @@ mpii_create_sensors(struct mpii_softc *sc)
strlcpy(sc->sc_sensordev.xname, DEVNAME(sc),
sizeof(sc->sc_sensordev.xname));
- for (i = sc->sc_vd_id_low; i < sc->sc_vd_id_low + sc->sc_vd_count;
- i++) {
- link = scsi_get_link(ssc, i, 0);
+ for (i = 0; i < sc->sc_vd_count; i++) {
+ link = scsi_get_link(ssc, i + sc->sc_vd_id_low, 0);
if (link == NULL)
goto bad;