From patchwork Fri Jan 7 06:50:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Jin X-Patchwork-Id: 462761 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p076pBQm006375 for ; Fri, 7 Jan 2011 06:51:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753924Ab1AGGvK (ORCPT ); Fri, 7 Jan 2011 01:51:10 -0500 Received: from rcsinet10.oracle.com ([148.87.113.121]:38982 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751328Ab1AGGvJ (ORCPT ); Fri, 7 Jan 2011 01:51:09 -0500 Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p076oWDx014283 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Jan 2011 06:50:33 GMT Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p076jFP9000859; Fri, 7 Jan 2011 06:50:27 GMT Received: from abhmt001.oracle.com by acsmt354.oracle.com with ESMTP id 938306531294383023; Thu, 06 Jan 2011 22:50:23 -0800 Received: from [10.182.120.253] (/10.182.120.253) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 06 Jan 2011 22:50:18 -0800 Message-ID: <4D26B7A4.9000209@oracle.com> Date: Fri, 07 Jan 2011 14:50:12 +0800 From: Joe Jin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre OracleBeehiveExtension/1.0.0.2-OracleInternal ObetStats/CATLAF_1292475699435-498544290 Thunderbird/3.1.7 MIME-Version: 1.0 To: jeremy@goop.org, ian.campbell@citrix.com, Andrew Morton 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 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 07 Jan 2011 06:51:11 +0000 (UTC) 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; }