summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-11-27 07:46:26 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-11-27 07:46:26 +0000
commit24d821b4bdeaecda24d55cf921d4b6c31c1160a2 (patch)
tree0e37b4a0963f20b13ecd4eb87910321380e7c5fa /sys
parenta2fa7086eb83ca2e23726a92bcef3907b7d397bf (diff)
Don't use dmamap->dm_nsegs after calling bus_dmamap_unload() on
dmamap. bus_dmamap_unload() invalidates dm_nsegs. Instead, use a saved value of dm_nsegs when calling bus_dmamem_free(). ok marco@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/aic79xx.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/dev/ic/aic79xx.c b/sys/dev/ic/aic79xx.c
index ed96571ca6c..7878a6338f3 100644
--- a/sys/dev/ic/aic79xx.c
+++ b/sys/dev/ic/aic79xx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aic79xx.c,v 1.29 2005/11/20 03:58:59 brad Exp $ */
+/* $OpenBSD: aic79xx.c,v 1.30 2005/11/27 07:46:25 krw Exp $ */
/*
* Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom
@@ -10332,9 +10332,11 @@ ahd_freedmamem(struct ahd_softc* ahd, struct map_node *map)
for(i = 0; i < dmamap->dm_nsegs; i++)
size += dmamap->dm_segs[i].ds_len;
+ /* i == dmamap->dm_nsegs, which is invalidated by bus_dmamap_unload. */
+
bus_dmamap_unload(tag, dmamap);
bus_dmamem_unmap(tag, map->vaddr, size);
- bus_dmamem_free(tag, dmamap->dm_segs, dmamap->dm_nsegs);
+ bus_dmamem_free(tag, dmamap->dm_segs, i);
bus_dmamap_destroy(tag, dmamap);
}