From: Joe Jin <joe.jin@oracle.com>
To: jeremy@goop.org, ian.campbell@citrix.com,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fbdev@vger.kernel.org, xen-devel@lists.xensource.com,
gurudas.pai@oracle.com, guru.anbalagane@oracle.com,
greg.marsden@oracle.com, joe.jin@oracle.com,
linux-kernel@vger.kernel.org
Subject: [patch] xen-event: validate irq before get evtchn by irq
Date: Fri, 07 Jan 2011 06:50:12 +0000 [thread overview]
Message-ID: <4D26B7A4.9000209@oracle.com> (raw)
Hi,
When get event channel by irq by irq, may irq is not a valid one under
some condition -- so far we found irq is -1 during suspend/resume, so
worth to validate it rather than return incorrect data.
Please review and comment.
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Tested-by: Gurudas Pai <gurudas.pai@oracle.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
events.c | 3 +++
1 file changed, 3 insertions(+)
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;
}
WARNING: multiple messages have this Message-ID (diff)
From: Joe Jin <joe.jin@oracle.com>
To: jeremy@goop.org, ian.campbell@citrix.com,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fbdev@vger.kernel.org, xen-devel@lists.xensource.com,
gurudas.pai@oracle.com, guru.anbalagane@oracle.com,
greg.marsden@oracle.com, joe.jin@oracle.com,
linux-kernel@vger.kernel.org
Subject: [patch] xen-event: validate irq before get evtchn by irq
Date: Fri, 07 Jan 2011 14:50:12 +0800 [thread overview]
Message-ID: <4D26B7A4.9000209@oracle.com> (raw)
Hi,
When get event channel by irq by irq, may irq is not a valid one under
some condition -- so far we found irq is -1 during suspend/resume, so
worth to validate it rather than return incorrect data.
Please review and comment.
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Tested-by: Gurudas Pai <gurudas.pai@oracle.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
events.c | 3 +++
1 file changed, 3 insertions(+)
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;
}
next reply other threads:[~2011-01-07 6:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-07 6:50 Joe Jin [this message]
2011-01-07 6:50 ` [patch] xen-event: validate irq before get evtchn by irq Joe Jin
2011-01-07 9:24 ` Ian Campbell
2011-01-07 9:24 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D26B7A4.9000209@oracle.com \
--to=joe.jin@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=greg.marsden@oracle.com \
--cc=guru.anbalagane@oracle.com \
--cc=gurudas.pai@oracle.com \
--cc=ian.campbell@citrix.com \
--cc=jeremy@goop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.