diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2005-07-29 16:56:14 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2005-07-29 16:56:14 +0000 |
commit | 2f90a71b275e539c08bbf2cc24b1991aca20a9c1 (patch) | |
tree | c761a1451a28b5bf567113592ce4d67280a22f5b /sys/dev | |
parent | 259078c317bce5d49e4420a8a0618038cff2f741 (diff) |
Per art's email, don't keep something bigger than > 256 bytes on the stack.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/ami.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index 2a4075db29b..ce327a32f1e 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.49 2005/07/29 16:01:30 marco Exp $ */ +/* $OpenBSD: ami.c,v 1.50 2005/07/29 16:56:13 marco Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -1866,18 +1866,25 @@ ami_ioctl_inq(sc, bi) struct ami_softc *sc; bioc_inq *bi; { - char plist[AMI_BIG_MAX_PDRIVES]; struct ami_big_diskarray *p; /* struct too large for stack */ + char *plist; int i, s, t; int off; int error = 0; p = malloc(sizeof *p, M_DEVBUF, M_NOWAIT); if (!p) { - printf("%s: no memory for raw interface\n",sc->sc_dev.dv_xname); + printf("%s: no memory for disk array\n",sc->sc_dev.dv_xname); return (ENOMEM); } + plist = malloc(AMI_BIG_MAX_PDRIVES, M_DEVBUF, M_NOWAIT); + if (!plist) { + printf("%s: no memory for disk list\n",sc->sc_dev.dv_xname); + error = ENOMEM; + goto bail; + } + if (ami_mgmt(sc, AMI_FCOP, AMI_FC_RDCONF, 0, sizeof *p, p)) { error = EINVAL; goto bail; @@ -1903,6 +1910,7 @@ ami_ioctl_inq(sc, bi) } } + free(plist, M_DEVBUF); bail: free(p, M_DEVBUF); |