summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-04-20 04:39:12 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-04-20 04:39:12 +0000
commitb1fa5050b9df85f9b036da9ddff191ac47748929 (patch)
treef262b94d3ebc13eab09cc2a13ab784a85e797f0c /sys
parent2c2b86fa0b50b60eb407054dafe48f578323d588 (diff)
this is the proper fix for krws bug. i feel kinda bad taking the commit
from him since he did most of the hard work on it. when marco added the sensor for logical disks he added some extra bits to the softc, but inside an #if NBIO > 0 block. NBIO is set by "bio.h" which was included in ami.c, but not in ami_pci.c which is what is actually responsible for getting the softc allocated. because of this the softc in the rest of the system was smaller than what ami.c needed, so technically it was using unallocated memory. in krws case that unallocated space was filled with garbage, hence his panic. the moral of this story is do NOT put #if inside structs that are passed between different source files. its too easy to have this kind of screwup happen.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/ami.c3
-rw-r--r--sys/dev/ic/amivar.h5
2 files changed, 3 insertions, 5 deletions
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index 278cc0f4100..d60afb8d6ec 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.146 2006/04/19 03:38:53 krw Exp $ */
+/* $OpenBSD: ami.c,v 1.147 2006/04/20 04:39:11 dlg Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -576,7 +576,6 @@ ami_attach(struct ami_softc *sc)
else
sc->sc_ioctl = ami_ioctl;
- sc->sc_first_poll = 0;
if (sensor_task_register(sc, ami_refresh, 10))
printf("%s: unable to register update task\n", DEVNAME(sc));
#endif /* NBIO > 0 */
diff --git a/sys/dev/ic/amivar.h b/sys/dev/ic/amivar.h
index 0a3bba308a4..065d92d9f2b 100644
--- a/sys/dev/ic/amivar.h
+++ b/sys/dev/ic/amivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: amivar.h,v 1.45 2006/04/18 04:15:44 marco Exp $ */
+/* $OpenBSD: amivar.h,v 1.46 2006/04/20 04:39:11 dlg Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -138,11 +138,10 @@ struct ami_softc {
char dev[16];
} sc_hdr[AMI_BIG_MAX_LDRIVES];
struct ami_rawsoftc *sc_rawsoftcs;
-#if NBIO > 0
+
int sc_first_poll;
struct sensor *sc_sens_ld;
struct ami_big_diskarray *sc_bd;
-#endif /* NBIO > 0 */
};
int ami_attach(struct ami_softc *sc);