[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xen-devel] [PATCH v4 08/13] x86/IRQs: correct/tighten vector check in _clear_irq_vector()
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <JBeulich@xxxxxxxx>
- Date: Tue, 16 Jul 2019 07:42:16 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2DLRyLVa47HeumEAIDYVDIcxrFhYKOx7Yr5EcFAH3bU=; b=BdapuSBL2ukZd7smOkwYH6WRchNgxSwtz7wPy5ffduYPzuScSRJIFNVt4qaXsjQOnidA843Grx3RIUqHToGQm4TW0catBL8dKpnCIk+b/X8mD4GrtWszRuM4wPvouBvh5VRR/w7RM4hy5ue8hlXW1mb9YX7DDgJS+RwxITWZcVRlCIITZmr65aJ0FHkH3lTTh9xMlMK/re/uPGFtb1lQzdYrk8qtd76BSGGXbVabRocCvOO4t+yy0XRCZvJy7x1kipEauCjRyxgOuJjXqaCosh6wGuWDudSPbUwvH9TUtP4/8qwSdR0VnT33YuLyHykwGVL/eYIu4FijDm+nC+iQ3g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QTMiJ1LoXxnvDnYsP1gHDVUYXycChlEyoFXsvlSXCjRs7eFeN6xl4iQMhMLhcisSmFMLleStCRXA5tksGtYnzexMibHxPi3clyTytHcrEr9PxI+V0Jg+1wQiTqQubSPqWTmFzbQl2el8t6M5pqODJh1OLRDKKB61gmSeCwH+npjcoZ1OtNPqzibj9fw4ZEiWcCQOZiB63+4wQlm5Q74ufR0vuSdGzRyvxtXvNDpUVBq28n/+Q3hWp+P8k/G+fwFeUEvBpbwAtGIA8EWzxc2ca8CuanmAlS2xJI60yyTQN4wBHNwfkVksj/YVdXINk11X2xzJ8BPEx6QuwcFOYnoyAQ==
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Tue, 16 Jul 2019 07:48:50 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHVO6n9JfqMcyF04UemTlO4Z+Go5Q==
- Thread-topic: [PATCH v4 08/13] x86/IRQs: correct/tighten vector check in _clear_irq_vector()
If any particular value was to be checked against, it would need to be
IRQ_VECTOR_UNASSIGNED.
Reported-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Be more strict though and use valid_irq_vector() instead.
Take the opportunity and also convert local variables to unsigned int.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
v2: New.
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -283,14 +283,13 @@ void destroy_irq(unsigned int irq)
static void _clear_irq_vector(struct irq_desc *desc)
{
- unsigned int cpu;
- int vector, old_vector, irq = desc->irq;
+ unsigned int cpu, old_vector, irq = desc->irq;
+ unsigned int vector = desc->arch.vector;
cpumask_t tmp_mask;
- BUG_ON(!desc->arch.vector);
+ BUG_ON(!valid_irq_vector(vector));
/* Always clear desc->arch.vector */
- vector = desc->arch.vector;
cpumask_and(&tmp_mask, desc->arch.cpu_mask, &cpu_online_map);
for_each_cpu(cpu, &tmp_mask) {
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|