summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-04-15 02:03:34 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-04-15 02:03:34 +0000
commitb3853a6bce5868f5aa63c916e63c21bd25a8dba4 (patch)
treec4e4d798d77136b523d1792d68c998cc04bdd4e4 /sys/arch
parent229554b33580f244562735aec69b9edcc7077bda (diff)
make load_raw do the same as the others and set mapsize and nsegs to
zero so that we return an empty map on error.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/bus_dma.c8
-rw-r--r--sys/arch/i386/i386/bus_dma.c8
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/bus_dma.c b/sys/arch/amd64/amd64/bus_dma.c
index eb906a4cea5..6f2eb97d7a5 100644
--- a/sys/arch/amd64/amd64/bus_dma.c
+++ b/sys/arch/amd64/amd64/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.23 2009/04/15 01:58:27 oga Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.24 2009/04/15 02:03:33 oga Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@@ -313,6 +313,12 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
int first = 1;
int i, seg = 0;
+ /*
+ * Make sure that on error condition we return "no valid mappings".
+ */
+ map->dm_mapsize = 0;
+ map->dm_nsegs = 0;
+
if (nsegs > map->_dm_segcnt || size > map->_dm_size)
return (EINVAL);
diff --git a/sys/arch/i386/i386/bus_dma.c b/sys/arch/i386/i386/bus_dma.c
index 8de38929bd3..59cf6082ef7 100644
--- a/sys/arch/i386/i386/bus_dma.c
+++ b/sys/arch/i386/i386/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.13 2009/04/15 01:58:27 oga Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.14 2009/04/15 02:03:33 oga Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -280,6 +280,12 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map, bus_dma_segment_t *segs,
int first = 1;
int i, seg = 0;
+ /*
+ * Make sure that on error condition we return "no valid mappings".
+ */
+ map->dm_mapsize = 0;
+ map->dm_nsegs = 0;
+
if (nsegs > map->_dm_segcnt || size > map->_dm_size)
return (EINVAL);