Showing error 821

User: Jiri Slaby
Error type: Resource Leak
Error type description: The code omits to put the resource to the system for reuse
File location: arch/x86/xen/irq.c
Line in file: 64
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:40:13 UTC


Source:

 34        xen_init_IRQ();
 35}
 36
 37static unsigned long xen_save_fl(void)
 38{
 39        struct vcpu_info *vcpu;
 40        unsigned long flags;
 41
 42        vcpu = x86_read_percpu(xen_vcpu);
 43
 44        /* flag has opposite sense of mask */
 45        flags = !vcpu->evtchn_upcall_mask;
 46
 47        /* convert to IF type flag
 48           -0 -> 0x00000000
 49           -1 -> 0xffffffff
 50        */
 51        return (-flags) & X86_EFLAGS_IF;
 52}
 53
 54static void xen_restore_fl(unsigned long flags)
 55{
 56        struct vcpu_info *vcpu;
 57
 58        /* convert from IF type flag */
 59        flags = !(flags & X86_EFLAGS_IF);
 60
 61        /* There's a one instruction preempt window here.  We need to
 62           make sure we're don't switch CPUs between getting the vcpu
 63           pointer and updating the mask. */
 64        preempt_disable();
 65        vcpu = x86_read_percpu(xen_vcpu);
 66        vcpu->evtchn_upcall_mask = flags;
 67        preempt_enable_no_resched();
 68
 69        /* Doesn't matter if we get preempted here, because any
 70           pending event will get dealt with anyway. */
 71
 72        if (flags == 0) {
 73                preempt_check_resched();
 74                barrier(); /* unmask then check (avoid races) */
Show full sources