|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] Re: [patch] xen-event: validate irq before get evtchn by irq
To: |
Joe Jin <joe.jin@xxxxxxxxxx> |
Subject: |
[Xen-devel] Re: [patch] xen-event: validate irq before get evtchn by irq |
From: |
Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx> |
Date: |
Fri, 7 Jan 2011 09:24:34 +0000 |
Cc: |
"jeremy@xxxxxxxx" <jeremy@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "gurudas.pai@xxxxxxxxxx" <gurudas.pai@xxxxxxxxxx>, "guru.anbalagane@xxxxxxxxxx" <guru.anbalagane@xxxxxxxxxx>, "greg.marsden@xxxxxxxxxx" <greg.marsden@xxxxxxxxxx>, "linux-fbdev@xxxxxxxxxxxxxxx" <linux-fbdev@xxxxxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> |
Delivery-date: |
Fri, 07 Jan 2011 01:26:09 -0800 |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
In-reply-to: |
<4D26B7A4.9000209@xxxxxxxxxx> |
List-help: |
<mailto:xen-devel-request@lists.xensource.com?subject=help> |
List-id: |
Xen developer discussion <xen-devel.lists.xensource.com> |
List-post: |
<mailto:xen-devel@lists.xensource.com> |
List-subscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |
List-unsubscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |
Organization: |
Citrix Systems, Inc. |
References: |
<4D26B7A4.9000209@xxxxxxxxxx> |
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
On Fri, 2011-01-07 at 06:50 +0000, Joe Jin wrote:
> 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.
You've accidentally got "by irq" twice there and "may irq is not a valid
one" doesn't read quite right.
Perhaps something like:
"When getting an event channel from an IRQ if the IRQ is not valid then
warn and return an error in the form of the invalid event channel.
This catches errors such as trying to notify an IRQ before connecting to
the backend (e.g. during suspend/resume)."
> Please review and comment.
>
> Signed-off-by: Joe Jin <joe.jin@xxxxxxxxxx>
> Tested-by: Gurudas Pai <gurudas.pai@xxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Thanks,
Ian.
> Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>
> ---
> 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;
> }
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|