diff mbox

xen-event: validate irq before get evtchn by irq

Message ID 4D26B7A4.9000209@oracle.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Joe Jin Jan. 7, 2011, 6:50 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index ac7b42f..006dd7b 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -175,6 +175,9 @@  static struct irq_info *info_for_irq(unsigned irq)
 
 static unsigned int evtchn_from_irq(unsigned irq)
 {
+	if (WARN(irq < 0 || irq >= nr_irqs, "Invalid irq %d!\n", irq))
+		return 0;
+
 	return info_for_irq(irq)->evtchn;
 }