summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2013-01-15 03:14:02 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2013-01-15 03:14:02 +0000
commit2ea4b63ef4b9d6c08e9fdb025db813d69db7a6de (patch)
tree66dcb70de75f9680909a455349c9a01bbfa0c7ea /sys
parent30678f30c3762aa9ec49cca79174c1c3acc34942 (diff)
Fix segmentation of buffers that straddle a boundary.
ok dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/dev/iommu.c4
-rw-r--r--sys/arch/sparc64/dev/viommu.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c
index 41d347fb823..b4d7faa1525 100644
--- a/sys/arch/sparc64/dev/iommu.c
+++ b/sys/arch/sparc64/dev/iommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommu.c,v 1.65 2012/08/17 20:46:50 kettenis Exp $ */
+/* $OpenBSD: iommu.c,v 1.66 2013/01/15 03:14:01 kettenis Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -1134,7 +1134,7 @@ iommu_dvmamap_append_range(bus_dma_tag_t t, bus_dmamap_t map, paddr_t pa,
*/
seg->ds_addr = sgstart;
- seg->ds_len = boundary - (sgstart & bd_mask);
+ seg->ds_len = boundary - (sgstart & ~bd_mask);
sgstart += seg->ds_len; /* sgend stays the same */
length -= seg->ds_len;
diff --git a/sys/arch/sparc64/dev/viommu.c b/sys/arch/sparc64/dev/viommu.c
index 9c14a566480..3a84e3f0ff8 100644
--- a/sys/arch/sparc64/dev/viommu.c
+++ b/sys/arch/sparc64/dev/viommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: viommu.c,v 1.12 2011/05/18 23:36:31 ariane Exp $ */
+/* $OpenBSD: viommu.c,v 1.13 2013/01/15 03:14:01 kettenis Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -666,7 +666,7 @@ viommu_dvmamap_append_range(bus_dma_tag_t t, bus_dmamap_t map, paddr_t pa,
*/
seg->ds_addr = sgstart;
- seg->ds_len = boundary - (sgstart & bd_mask);
+ seg->ds_len = boundary - (sgstart & ~bd_mask);
sgstart += seg->ds_len; /* sgend stays the same */
length -= seg->ds_len;