Module: xenomai-2.5 Branch: master Commit: 3d9f3a4afb53ac445edba5107463e8691f55d250 URL: http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=3d9f3a4afb53ac445edba5107463e8691f55d250
Author: Philippe Gerum <r...@xenomai.org> Date: Mon Jan 11 16:51:23 2010 +0100 x86: always check whether irq descriptors are present --- ksrc/arch/x86/hal-common.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ksrc/arch/x86/hal-common.c b/ksrc/arch/x86/hal-common.c index d037538..7819aa8 100644 --- a/ksrc/arch/x86/hal-common.c +++ b/ksrc/arch/x86/hal-common.c @@ -363,7 +363,9 @@ int rthal_irq_host_request(unsigned irq, { unsigned long flags; - if (irq >= IPIPE_NR_XIRQS || !handler) + if (irq >= IPIPE_NR_XIRQS || + handler == NULL || + rthal_irq_descp(irq) == NULL) return -EINVAL; spin_lock_irqsave(&rthal_irq_descp(irq)->lock, flags); @@ -383,7 +385,9 @@ int rthal_irq_host_release(unsigned irq, void *dev_id) { unsigned long flags; - if (irq >= NR_IRQS || rthal_linux_irq[irq].count == 0) + if (irq >= IPIPE_NR_XIRQS || + rthal_linux_irq[irq].count == 0 || + rthal_irq_descp(irq) == NULL) return -EINVAL; free_irq(irq, dev_id); @@ -401,7 +405,7 @@ int rthal_irq_host_release(unsigned irq, void *dev_id) int rthal_irq_enable(unsigned irq) { - if (irq >= NR_IRQS) + if (irq >= NR_IRQS || rthal_irq_descp(irq) == NULL) return -EINVAL; rthal_irq_desc_status(irq) &= ~IRQ_DISABLED; @@ -412,7 +416,7 @@ int rthal_irq_enable(unsigned irq) int rthal_irq_disable(unsigned irq) { - if (irq >= NR_IRQS) + if (irq >= NR_IRQS || rthal_irq_descp(irq) == NULL) return -EINVAL; rthal_irq_desc_status(irq) |= IRQ_DISABLED; @@ -422,7 +426,7 @@ int rthal_irq_disable(unsigned irq) int rthal_irq_end(unsigned irq) { - if (irq >= NR_IRQS) + if (irq >= NR_IRQS || rthal_irq_descp(irq) == NULL) return -EINVAL; return rthal_irq_chip_end(irq); _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git