mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@eu.citrix.com>
To: Joe Jin <joe.jin@oracle.com>
Cc: "jeremy@goop.org" <jeremy@goop.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"gurudas.pai@oracle.com" <gurudas.pai@oracle.com>,
	"guru.anbalagane@oracle.com" <guru.anbalagane@oracle.com>,
	"greg.marsden@oracle.com" <greg.marsden@oracle.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [patch] xen-event: validate irq before get evtchn by irq
Date: Fri, 7 Jan 2011 09:24:34 +0000	[thread overview]
Message-ID: <1294392274.3831.3920.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <4D26B7A4.9000209@oracle.com>

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@oracle.com>
> Tested-by: Gurudas Pai <gurudas.pai@oracle.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

Thanks,
Ian.

> 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;
>  }
>  
> 



      reply	other threads:[~2011-01-07  9:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-07  6:50 Joe Jin
2011-01-07  9:24 ` Ian Campbell [this message]

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=1294392274.3831.3920.camel@zakaz.uk.xensource.com \
    --to=ian.campbell@eu.citrix.com \
    --cc=akpm@linux-foundation.org \
    --cc=greg.marsden@oracle.com \
    --cc=guru.anbalagane@oracle.com \
    --cc=gurudas.pai@oracle.com \
    --cc=jeremy@goop.org \
    --cc=joe.jin@oracle.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®