Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/hyperv Clear the allocated memory in hyperv_dma_allo...



details:   https://anonhg.NetBSD.org/src/rev/61e37391adf1
branches:  trunk
changeset: 465886:61e37391adf1
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Fri Dec 06 12:46:06 2019 +0000

description:
Clear the allocated memory in hyperv_dma_alloc().

diffstat:

 sys/dev/hyperv/hyperv_common.c |  8 ++++++--
 sys/dev/hyperv/vmbus.c         |  6 ++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diffs (63 lines):

diff -r 249090d1d6db -r 61e37391adf1 sys/dev/hyperv/hyperv_common.c
--- a/sys/dev/hyperv/hyperv_common.c    Fri Dec 06 12:41:17 2019 +0000
+++ b/sys/dev/hyperv/hyperv_common.c    Fri Dec 06 12:46:06 2019 +0000
@@ -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 @@
                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 -r 249090d1d6db -r 61e37391adf1 sys/dev/hyperv/vmbus.c
--- a/sys/dev/hyperv/vmbus.c    Fri Dec 06 12:41:17 2019 +0000
+++ b/sys/dev/hyperv/vmbus.c    Fri Dec 06 12:46:06 2019 +0000
@@ -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 @@
                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 @@
                    "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;



Home | Main Index | Thread Index | Old Index