summaryrefslogtreecommitdiff
path: root/sys/dev/hyperv
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
parentbd8fa5325bc81f3c8df58fd95659f999e5667e62 (diff)
Clear the allocated memory in hyperv_dma_alloc().
Diffstat (limited to 'sys/dev/hyperv')
-rw-r--r--sys/dev/hyperv/hyperv_common.c8
-rw-r--r--sys/dev/hyperv/vmbus.c6
2 files changed, 8 insertions, 6 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);
diff --git a/sys/dev/hyperv/vmbus.c b/sys/dev/hyperv/vmbus.c
index f6c7cecbe25..d618ad61366 100644
--- a/sys/dev/hyperv/vmbus.c
+++ b/sys/dev/hyperv/vmbus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vmbus.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $ */
+/* $NetBSD: vmbus.c,v 1.6 2019/12/06 12:46:06 nonaka Exp $ */
/* $OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $ */
/*-
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.6 2019/12/06 12:46:06 nonaka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -985,7 +985,6 @@ vmbus_channel_alloc(struct vmbus_softc *sc)
kmem_free(ch, sizeof(*ch));
return NULL;
}
- memset(ch->ch_monprm, 0, sizeof(*ch->ch_monprm));
ch->ch_refs = 1;
ch->ch_sc = sc;
@@ -1264,7 +1263,6 @@ vmbus_channel_ring_create(struct vmbus_channel *ch, uint32_t buflen)
"failed to allocate channel ring\n");
return ENOMEM;
}
- memset(ch->ch_ring, 0, ch->ch_ring_size);
memset(&ch->ch_wrd, 0, sizeof(ch->ch_wrd));
ch->ch_wrd.rd_ring = (struct vmbus_bufring *)ch->ch_ring;