summaryrefslogtreecommitdiff
path: root/sys/dev/hyperv/hyperv_common.c
diff options
context:
space:
mode:
authornonaka <nonaka@NetBSD.org>2019-12-06 12:46:06 +0000
committernonaka <nonaka@NetBSD.org>2019-12-06 12:46:06 +0000
commit0036f4b358d892ba33d0d8c17c42e00134477a54 (patch)
tree15f0bfd13327fc6c9612084e708f488fa61a92fd /sys/dev/hyperv/hyperv_common.c
parentbd8fa5325bc81f3c8df58fd95659f999e5667e62 (diff)
Clear the allocated memory in hyperv_dma_alloc().
Diffstat (limited to 'sys/dev/hyperv/hyperv_common.c')
-rw-r--r--sys/dev/hyperv/hyperv_common.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/hyperv/hyperv_common.c b/sys/dev/hyperv/hyperv_common.c
index 620865c45b6..bc062c621ab 100644
--- a/sys/dev/hyperv/hyperv_common.c
+++ b/sys/dev/hyperv/hyperv_common.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hyperv_common.c,v 1.2 2019/05/31 04:23:19 nonaka Exp $ */
+/* $NetBSD: hyperv_common.c,v 1.3 2019/12/06 12:46:06 nonaka Exp $ */
/*-
* Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.2 2019/05/31 04:23:19 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.3 2019/12/06 12:46:06 nonaka Exp $");
#include "hyperv.h"
@@ -155,6 +155,10 @@ hyperv_dma_alloc(bus_dma_tag_t dmat, struct hyperv_dma *dma, bus_size_t size,
goto fail4;
}
+ memset(dma->addr, 0, dma->map->dm_mapsize);
+ bus_dmamap_sync(dmat, dma->map, 0, dma->map->dm_mapsize,
+ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+
return dma->addr;
fail4: bus_dmamap_destroy(dmat, dma->map);