diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-04-02 15:23:37 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-04-02 15:23:37 +0000 |
commit | f8b1085de6c25a9261f9bf4b6798f95855bfb61a (patch) | |
tree | d64e90128372755ebce5bdeac7e113d6264f9fe0 /sys/dev | |
parent | 5da7c6fb59bf55e2a59128ff22661097db509f85 (diff) |
Safer, big mem friendly, allocation of identify buf that is the
target of DMA.
ok dlg@ deraadt@ thib@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/atascsi.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index f9f89edf3e1..f64b631c452 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.101 2011/02/03 21:22:19 matthew Exp $ */ +/* $OpenBSD: atascsi.c,v 1.102 2011/04/02 15:23:36 krw Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -26,6 +26,7 @@ #include <sys/device.h> #include <sys/proc.h> #include <sys/queue.h> +#include <sys/pool.h> #include <scsi/scsi_all.h> #include <scsi/scsi_disk.h> @@ -335,8 +336,8 @@ atascsi_probe(struct scsi_link *link) xa = scsi_io_get(&ahp->ahp_iopool, SCSI_NOSLEEP); if (xa == NULL) panic("no free xfers on a new port"); - /* XXX dma reachable */ - identify = malloc(sizeof(*identify), M_TEMP, M_WAITOK); + identify = dma_alloc(sizeof(*identify), + PR_WAITOK | PR_ZERO); xa->pmp_port = ap->ap_pmp_port; xa->data = identify; xa->datalen = sizeof(*identify); @@ -353,10 +354,10 @@ atascsi_probe(struct scsi_link *link) if (rv == 0) { bcopy(identify, &ap->ap_identify, sizeof(ap->ap_identify)); - free(identify, M_TEMP); + dma_free(identify, sizeof(*identify)); break; } - free(identify, M_TEMP); + dma_free(identify, sizeof(*identify)); delay(5000000); } while (count--); |