Thu Dec 8 03:34:48 2011 UTC ()
kmem_free() the appropriate size.

Thanks cegger@


(cherry)
diff -r1.60 -r1.61 src/sys/arch/xen/xen/evtchn.c

cvs diff -r1.60 -r1.61 src/sys/arch/xen/xen/evtchn.c (expand / switch to unified diff)

--- src/sys/arch/xen/xen/evtchn.c 2011/12/07 16:26:23 1.60
+++ src/sys/arch/xen/xen/evtchn.c 2011/12/08 03:34:44 1.61
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: evtchn.c,v 1.60 2011/12/07 16:26:23 cegger Exp $ */ 1/* $NetBSD: evtchn.c,v 1.61 2011/12/08 03:34:44 cherry Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Manuel Bouyer. 4 * Copyright (c) 2006 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -44,27 +44,27 @@ @@ -44,27 +44,27 @@
44 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 44 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
45 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 45 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
46 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 46 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
47 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 47 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
48 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 48 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
52 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 52 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 */ 53 */
54 54
55 55
56#include <sys/cdefs.h> 56#include <sys/cdefs.h>
57__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.60 2011/12/07 16:26:23 cegger Exp $"); 57__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.61 2011/12/08 03:34:44 cherry Exp $");
58 58
59#include "opt_xen.h" 59#include "opt_xen.h"
60#include "isa.h" 60#include "isa.h"
61#include "pci.h" 61#include "pci.h"
62 62
63#include <sys/param.h> 63#include <sys/param.h>
64#include <sys/cpu.h> 64#include <sys/cpu.h>
65#include <sys/kernel.h> 65#include <sys/kernel.h>
66#include <sys/systm.h> 66#include <sys/systm.h>
67#include <sys/device.h> 67#include <sys/device.h>
68#include <sys/proc.h> 68#include <sys/proc.h>
69#include <sys/kmem.h> 69#include <sys/kmem.h>
70#include <sys/reboot.h> 70#include <sys/reboot.h>
@@ -785,27 +785,27 @@ event_remove_handler(int evtch, int (*fu @@ -785,27 +785,27 @@ event_remove_handler(int evtch, int (*fu
785 *ihp = ih->ih_evt_next; 785 *ihp = ih->ih_evt_next;
786 mutex_spin_exit(&evtlock[evtch]); 786 mutex_spin_exit(&evtlock[evtch]);
787 787
788 ipls = ci->ci_isources[ih->ih_level]; 788 ipls = ci->ci_isources[ih->ih_level];
789 for (ihp = &ipls->ipl_handlers, ih = ipls->ipl_handlers; 789 for (ihp = &ipls->ipl_handlers, ih = ipls->ipl_handlers;
790 ih != NULL; 790 ih != NULL;
791 ihp = &ih->ih_ipl_next, ih = ih->ih_ipl_next) { 791 ihp = &ih->ih_ipl_next, ih = ih->ih_ipl_next) {
792 if (ih->ih_fun == func && ih->ih_arg == arg) 792 if (ih->ih_fun == func && ih->ih_arg == arg)
793 break; 793 break;
794 } 794 }
795 if (ih == NULL) 795 if (ih == NULL)
796 panic("event_remove_handler"); 796 panic("event_remove_handler");
797 *ihp = ih->ih_ipl_next; 797 *ihp = ih->ih_ipl_next;
798 kmem_free(ih, sizeof (struct iplsource)); 798 kmem_free(ih, sizeof (struct intrhand));
799 if (evts->ev_handlers == NULL) { 799 if (evts->ev_handlers == NULL) {
800 xen_atomic_clear_bit(&ci->ci_evtmask[0], evtch); 800 xen_atomic_clear_bit(&ci->ci_evtmask[0], evtch);
801 evcnt_detach(&evts->ev_evcnt); 801 evcnt_detach(&evts->ev_evcnt);
802 kmem_free(evts, sizeof (struct evtsource)); 802 kmem_free(evts, sizeof (struct evtsource));
803 evtsource[evtch] = NULL; 803 evtsource[evtch] = NULL;
804 } else { 804 } else {
805 intr_calculatemasks(evts, evtch, ci); 805 intr_calculatemasks(evts, evtch, ci);
806 } 806 }
807 return 0; 807 return 0;
808} 808}
809 809
810void 810void
811hypervisor_enable_event(unsigned int evtch) 811hypervisor_enable_event(unsigned int evtch)