Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen Re-zero the attach args before setting them...



details:   https://anonhg.NetBSD.org/src/rev/00da1b77ed8d
branches:  trunk
changeset: 752628:00da1b77ed8d
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Tue Mar 02 16:44:08 2010 +0000

description:
Re-zero the attach args before setting them up for a new call to
config_found_ia().  In this way we avoid passing an uninitialized
pcibus_attach_args.pba_pc that will cause problems, later.

diffstat:

 sys/arch/xen/xen/hypervisor.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (79 lines):

diff -r 20959625fbd8 -r 00da1b77ed8d sys/arch/xen/xen/hypervisor.c
--- a/sys/arch/xen/xen/hypervisor.c     Tue Mar 02 16:43:48 2010 +0000
+++ b/sys/arch/xen/xen/hypervisor.c     Tue Mar 02 16:44:08 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.50 2009/10/23 02:32:34 snj Exp $ */
+/* $NetBSD: hypervisor.c,v 1.51 2010/03/02 16:44:08 dyoung Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.50 2009/10/23 02:32:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.51 2010/03/02 16:44:08 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -207,7 +207,7 @@
 
        xengnt_init();
 
-       memset(&hac.hac_vcaa, 0, sizeof(hac.hac_vcaa));
+       memset(&hac, 0, sizeof(hac));
        hac.hac_vcaa.vcaa_name = "vcpu";
        hac.hac_vcaa.vcaa_caa.cpu_number = 0;
        hac.hac_vcaa.vcaa_caa.cpu_role = CPU_ROLE_SP;
@@ -217,22 +217,27 @@
        events_init();
 
 #if NXENBUS > 0
+       memset(&hac, 0, sizeof(hac));
        hac.hac_xenbus.xa_device = "xenbus";
        config_found_ia(self, "xendevbus", &hac.hac_xenbus, hypervisor_print);
 #endif
 #if NXENCONS > 0
+       memset(&hac, 0, sizeof(hac));
        hac.hac_xencons.xa_device = "xencons";
        config_found_ia(self, "xendevbus", &hac.hac_xencons, hypervisor_print);
 #endif
 #if NXENNET_HYPERVISOR > 0
+       memset(&hac, 0, sizeof(hac));
        hac.hac_xennet.xa_device = "xennet";
        xennet_scan(self, &hac.hac_xennet, hypervisor_print);
 #endif
 #if NXBD_HYPERVISOR > 0
+       memset(&hac, 0, sizeof(hac));
        hac.hac_xbd.xa_device = "xbd";
        xbd_scan(self, &hac.hac_xbd, hypervisor_print);
 #endif
 #if NNPX > 0
+       memset(&hac, 0, sizeof(hac));
        hac.hac_xennpx.xa_device = "npx";
        config_found_ia(self, "xendevbus", &hac.hac_xennpx, hypervisor_print);
 #endif
@@ -240,6 +245,7 @@
 #if NPCI > 0
 #if NACPICA > 0
        if (acpi_present) {
+               memset(&hac, 0, sizeof(hac));
                hac.hac_acpi.aa_iot = X86_BUS_SPACE_IO;
                hac.hac_acpi.aa_memt = X86_BUS_SPACE_MEM;
                hac.hac_acpi.aa_pc = NULL;
@@ -251,6 +257,7 @@
                config_found_ia(self, "acpibus", &hac.hac_acpi, 0);
        }
 #endif /* NACPICA */
+       memset(&hac, 0, sizeof(hac));
        hac.hac_pba.pba_iot = X86_BUS_SPACE_IO;
        hac.hac_pba.pba_memt = X86_BUS_SPACE_MEM;
        hac.hac_pba.pba_dmat = &pci_bus_dma_tag;
@@ -279,6 +286,7 @@
 #endif
 #if NISA > 0
        if (isa_has_been_seen == 0) {
+               memset(&hac, 0, sizeof(hac));
                hac.hac_iba._iba_busname = "isa";
                hac.hac_iba.iba_iot = X86_BUS_SPACE_IO;
                hac.hac_iba.iba_memt = X86_BUS_SPACE_MEM;



Home | Main Index | Thread Index | Old Index