summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-07-16 22:09:00 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-07-16 22:09:00 +0000
commitd47066e7d08c28707f6255bd1b3751a5bbf599d9 (patch)
tree4256b563a915048631ab881a9202fe4123b80ab5
parentbc0eca38db48b61f9e2c0478546e13299b956053 (diff)
take a 1k array off the stack by using malloc to get it. found by miod.
-rw-r--r--sys/scsi/ses.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c
index 612f9333ce9..e99a02fb1bb 100644
--- a/sys/scsi/ses.c
+++ b/sys/scsi/ses.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ses.c,v 1.37 2006/05/11 00:45:59 krw Exp $ */
+/* $OpenBSD: ses.c,v 1.38 2006/07/16 22:08:59 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -384,13 +384,17 @@ ses_make_sensors(struct ses_softc *sc, struct ses_type_desc *types, int ntypes)
#endif
enum sensor_type stype;
char *fmt;
- int typecnt[SES_NUM_TYPES];
+ int *typecnt;
int i, j;
if (ses_read_status(sc) != 0)
return (1);
- memset(typecnt, 0, sizeof(typecnt));
+ typecnt = malloc(sizeof(int) * SES_NUM_TYPES, M_TEMP, M_NOWAIT);
+ if (typecnt == NULL)
+ return (1);
+ memset(typecnt, 0, sizeof(int) * SES_NUM_TYPES);
+
TAILQ_INIT(&sc->sc_sensors);
#if NBIO > 0
TAILQ_INIT(&sc->sc_slots);
@@ -472,6 +476,7 @@ ses_make_sensors(struct ses_softc *sc, struct ses_type_desc *types, int ntypes)
status++;
}
+ free(typecnt, M_TEMP);
return (0);
error:
#if NBIO > 0
@@ -486,6 +491,7 @@ error:
TAILQ_REMOVE(&sc->sc_sensors, sensor, se_entry);
free(sensor, M_DEVBUF);
}
+ free(typecnt, M_TEMP);
return (1);
}