[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/IRQ: tighten vector checks
commit 302aa715fe68a20914aa1f6a4d791efb05cf2f0a Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon Jul 22 11:47:06 2019 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Jul 22 11:47:06 2019 +0200 x86/IRQ: tighten vector checks Use valid_irq_vector() rather than "> 0". Also replace an open-coded use of IRQ_VECTOR_UNASSIGNED. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/irq.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 5e062497ee..7e3e81f0ba 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -342,7 +342,7 @@ void clear_irq_vector(int irq) int irq_to_vector(int irq) { - int vector = -1; + int vector = IRQ_VECTOR_UNASSIGNED; BUG_ON(irq >= nr_irqs || irq < 0); @@ -452,15 +452,18 @@ static vmask_t *irq_get_used_vector_mask(int irq) int vector; vector = irq_to_vector(irq); - if ( vector > 0 ) + if ( valid_irq_vector(vector) ) { - printk(XENLOG_INFO "IRQ %d already assigned vector %d\n", + printk(XENLOG_INFO "IRQ%d already assigned vector %02x\n", irq, vector); ASSERT(!test_bit(vector, ret)); set_bit(vector, ret); } + else if ( vector != IRQ_VECTOR_UNASSIGNED ) + printk(XENLOG_WARNING "IRQ%d mapped to bogus vector %02x\n", + irq, vector); } } else if ( IO_APIC_IRQ(irq) && @@ -491,7 +494,7 @@ static int _assign_irq_vector(struct irq_desc *desc, const cpumask_t *mask) vmask_t *irq_used_vectors = NULL; old_vector = irq_to_vector(irq); - if ( old_vector > 0 ) + if ( valid_irq_vector(old_vector) ) { cpumask_t tmp_mask; @@ -555,7 +558,7 @@ next: current_vector = vector; current_offset = offset; - if ( old_vector > 0 ) + if ( valid_irq_vector(old_vector) ) { cpumask_and(desc->arch.old_cpu_mask, desc->arch.cpu_mask, &cpu_online_map); -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |